//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.hustcad.plm.pdm.workflow.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.hustcad.plm.basic.util.TyplmEntityBaseUtil;
import com.hustcad.plm.basic.util.TyplmLoggerUtil;
import com.hustcad.plm.pdm.common.service.entity.TyplmEntityBaseService;
import com.hustcad.plm.pdm.common.util.CommonUtil;
import com.hustcad.plm.pdm.file.service.TyFileHandleService;
import com.hustcad.plm.pdm.file.service.TyplmFileHandleService;
import com.hustcad.plm.pdm.filevault.model.vo.ContentUploadVaultVO;
import com.hustcad.plm.pdm.filevault.model.vo.FileDataVO;
import com.hustcad.plm.pdm.filevault.service.TyplmContentDataService;
import com.hustcad.plm.pdm.filevault.service.TyplmVaultItemService;
import com.hustcad.plm.pdm.preference.util.TyplmPreferenceValueUtil;
import com.hustcad.plm.pdm.user.model.dto.PdmUserDTO;
import com.hustcad.plm.pdm.user.model.entity.PdmUser;
import com.hustcad.plm.pdm.user.service.TyplmGroupService;
import com.hustcad.plm.pdm.user.service.TyplmUserService;
import com.hustcad.plm.pdm.user.service.organization.PdmUserService;
import com.hustcad.plm.pdm.workflow.cmd.ExecuteListenCmd;
import com.hustcad.plm.pdm.workflow.converter.CustomProcessDiagramGenerator;
import com.hustcad.plm.pdm.workflow.handle.CountHandler;
import com.hustcad.plm.pdm.workflow.mapper.TyplmFlowContainerUsageLinkMapper;
import com.hustcad.plm.pdm.workflow.mapper.TyplmFlowTaskRecordLinkMapper;
import com.hustcad.plm.pdm.workflow.model.constant.WorkFlowContainerStatusEnum;
import com.hustcad.plm.pdm.workflow.model.constant.WorkFlowErrorCodeEnum;
import com.hustcad.plm.pdm.workflow.model.dto.ApprovalOpinionDTO;
import com.hustcad.plm.pdm.workflow.model.dto.CreateTaskRecordDTO;
import com.hustcad.plm.pdm.workflow.model.dto.FlowVariableDTO;
import com.hustcad.plm.pdm.workflow.model.dto.WithDrawProcessUserTaskVO;
import com.hustcad.plm.pdm.workflow.model.entity.DeliverTaskView;
import com.hustcad.plm.pdm.workflow.model.entity.ExecutionStrategyDTO;
import com.hustcad.plm.pdm.workflow.model.entity.FlowContainerUsageLink;
import com.hustcad.plm.pdm.workflow.model.entity.FlowHandlerDTO;
import com.hustcad.plm.pdm.workflow.model.entity.FlowInteractTask;
import com.hustcad.plm.pdm.workflow.model.entity.FlowTaskInfo;
import com.hustcad.plm.pdm.workflow.model.entity.FlowTaskRecord;
import com.hustcad.plm.pdm.workflow.model.entity.FlowTaskRecordLink;
import com.hustcad.plm.pdm.workflow.model.entity.FlowTaskUser;
import com.hustcad.plm.pdm.workflow.model.entity.FolwTaskParam;
import com.hustcad.plm.pdm.workflow.model.entity.OperateTaskView;
import com.hustcad.plm.pdm.workflow.model.entity.ParticipantsDTO;
import com.hustcad.plm.pdm.workflow.model.entity.Router;
import com.hustcad.plm.pdm.workflow.model.entity.TargetNode;
import com.hustcad.plm.pdm.workflow.model.entity.UserTaskDTO;
import com.hustcad.plm.pdm.workflow.model.entity.WorkFlow;
import com.hustcad.plm.pdm.workflow.model.entity.WorkFlowContainer;
import com.hustcad.plm.pdm.workflow.model.entity.WorkFlowContainerView;
import com.hustcad.plm.pdm.workflow.model.entity.WorkFlowContentDataLinkDO;
import com.hustcad.plm.pdm.workflow.model.entity.WorkFlowExpand;
import com.hustcad.plm.pdm.workflow.model.entity.WorkFlowSignElement;
import com.hustcad.plm.pdm.workflow.model.vo.FlowTaskRecordAndContentVO;
import com.hustcad.plm.pdm.workflow.model.vo.FlowTerminalVO;
import com.hustcad.plm.pdm.workflow.model.vo.RecordContentDataVO;
import com.hustcad.plm.pdm.workflow.model.vo.TyplmTaskVO;
import com.hustcad.plm.pdm.workflow.model.vo.WithdrawProcessVO;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowCommonService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowContainerObjectService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowElementService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowHandlerService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowInteractTaskService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowRecordExtendService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowTaskRecordLinkService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowTaskRecordService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowTaskUserService;
import com.hustcad.plm.pdm.workflow.service.TyplmFlowableTaskService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowContainerDatabaseServiceExt;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowContainerService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowContainerViewService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowContenDataLinkService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowExpandService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowProcessService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowSignService;
import com.hustcad.plm.pdm.workflow.service.TyplmWorkFlowtOperateTaskService;
import com.hustcad.plm.pdm.workflow.service.extend.TyplmFlowMessageExtendService;
import com.hustcad.plm.pdm.workflow.service.extend.TyplmFlowProcessExtendService;
import com.hustcad.plm.pdm.workflow.service.extend.TyplmMultilingualExtendService;
import com.hustcad.plm.pdm.workflow.service.extend.TyplmRoleExtendService;
import com.hustcad.plm.pdm.workflow.service.extend.TyplmWorkFlowAccessExtendService;
import com.hustcad.plm.pdm.workflow.util.TyplmWorkFlowUtil;
import com.ty.basic.entity.CTyEntityBaseDO;
import com.ty.basic.entity.IdentifierEntity;
import com.ty.basic.entity.access.AccessObjRightDO;
import com.ty.basic.entity.filevault.ContentDataDO;
import com.ty.basic.entity.org.GroupDO;
import com.ty.basic.entity.org.RoleDO;
import com.ty.basic.entity.org.UserDO;
import com.ty.basic.exception.message.SystemErrorCodeEnum;
import com.ty.basic.handler.exceptionhandler.exception.ResponseCodeEnum;
import com.ty.basic.handler.exceptionhandler.exception.TyException;
import com.ty.basic.query.PageUserIdQuery;
import com.ty.basic.service.snow.SnowflakeIdComponent;
import com.ty.basic.session.TyAccountContext;
import com.ty.basic.util.EntityBaseUtil;
import com.ty.basic.util.Pager;
import com.ty.basic.util.TySpringBeanUtil;
import com.ty.basic.utils.ArgumentUtils;
import com.ty.basic.utils.controller.CommonQuery;
import java.io.InputStream;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.BaseElement;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.CallActivity;
import org.flowable.bpmn.model.ExtensionElement;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.FlowNode;
import org.flowable.bpmn.model.FlowableListener;
import org.flowable.bpmn.model.Gateway;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.SequenceFlow;
import org.flowable.bpmn.model.UserTask;
import org.flowable.common.engine.api.FlowableException;
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.engine.HistoryService;
import org.flowable.engine.IdentityService;
import org.flowable.engine.ManagementService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricActivityInstanceQuery;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskInfo;
import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;

@Service
public class TyplmWorkFlowProcessServiceImpl implements TyplmWorkFlowProcessService {
    private static final Logger log = LoggerFactory.getLogger(TyplmWorkFlowProcessServiceImpl.class);
    private static final String CHANGE_URGENCY = "ChangeUrgency";
    @Resource
    private TyplmFlowableTaskService typlmFlowableTaskService;
    @Resource
    private TyplmFlowElementService typlmFlowElementService;
    @Resource
    private TyplmFlowTaskRecordService typlmFlowTaskRecordService;
    @Resource
    private TyplmUserService typlmUserService;
    @Resource
    private TyplmFlowTaskUserService typlmFlowTaskUserService;
    @Resource
    private TyplmFlowMessageExtendService typlmFlowMessageExtendService;
    @Resource
    private TaskService taskService;
    @Resource
    private TyplmWorkFlowContainerService typlmWorkFlowContainerService;
    @Resource
    private TyplmWorkFlowService typlmWorkFlowService;
    @Resource
    private TyplmFlowHandlerService typlmFlowHandlerService;
    @Resource
    private RepositoryService repositoryService;
    @Resource
    private IdentityService identityService;
    @Resource
    private RuntimeService runtimeService;
    @Resource
    private HistoryService historyService;
    @Resource
    private PdmUserService pdmUserService;
    @Resource
    private TyplmRoleExtendService typlmRoleExtendService;
    @Resource
    private TyplmGroupService typlmGroupService;
    @Resource
    private TyplmFlowTaskRecordLinkService typlmFlowTaskRecordLinkService;
    @Resource
    private TyplmWorkFlowContainerDatabaseServiceExt typlmWorkFlowContainerDatabaseServiceExt;
    @Resource
    private TyplmWorkFlowContainerViewService typlmWorkFlowContainerViewService;
    @Resource
    private TyplmFlowContainerObjectService typlmFlowContainerObjectService;
    @Resource
    private TyplmWorkFlowAccessExtendService typlmWorkFlowAccessExtendService;
    @Resource
    private TyplmFlowProcessExtendService flowProcessExtendService;
    @Resource
    private TyplmMultilingualExtendService typlmMultilingualExtendService;
    @Resource
    private TyplmFlowRecordExtendService typlmFlowRecordExtendService;
    @Resource
    private TyplmFlowInteractTaskService typlmFlowInteractTaskService;
    @Resource
    private TyplmFlowCommonService typlmFlowCommonService;
    @Resource
    private TyplmPreferenceValueUtil typlmPreferenceValueUtil;
    private static final String DELIVER_STATUS = "待办";
    private static final String MANAGER_TERMINATION = "管理员终止";
    private static final String CREATOR_TERMINATION = "创建者终止";
    private static final String COMPLETE_STATUS = "完成";
    private static final String OPERATOR_OTYPE = "com.ty.entity.user.PdmUser";
    private static final String CHOOSE = "Choose";
    private static final String REMARK = "remark";
    private static final String ROUTER_CHECK = "routerCheck";
    private static final String REQUIRED_FLAG = "requiredFlag";
    private static final String MULTI_CHOOSE_FLAG = "multiChooseFlag";
    private static final String REQUIRED_COMPLETE_COUNT = "requiredCompleteCount";
    private static final String LAST_CHOICE_FLAG = "lastChoiceFlag";
    private static final String COMPLETE_FLAG = "completeFlag";
    private static final Integer REQUIRED_VALUE = 1;
    private static final Integer REMARK_MAX_LENGTH = 2000;
    private static final String COMPLETE_TASK = "nrOfCompletedInstances";
    private static final String COMPLETE_SUFFIX = "Completed";
    private static final String FLOW_CONTAINER_OID = "flowContainerOid";
    @Resource
    private TyplmFlowProcessExtendService typlmFlowProcessExtendService;
    @Resource
    private TyplmWorkFlowExpandService typlmWorkFlowExpandService;
    @Resource
    private TyplmFlowTaskRecordLinkMapper typlmFlowTaskRecordLinkMapper;
    @Resource
    private TyFileHandleService tyFileHandleService;
    @Resource
    private TyplmVaultItemService typlmVaultItemService;
    @Resource
    private SnowflakeIdComponent snowflakeIdComponent;
    @Resource
    private TyplmContentDataService typlmContentDataService;
    @Resource
    private TyplmWorkFlowContenDataLinkService typlmWorkFlowContenDataLinkService;
    @Resource
    private TyplmFileHandleService fileHandleService;
    @Resource
    private TyplmEntityBaseService typlmEntityBaseService;
    @Resource
    private TyplmWorkFlowtOperateTaskService typlmWorkFlowtOperateTaskService;
    @Resource
    private TyplmFlowContainerUsageLinkMapper typlmFlowContainerUsageLinkMapper;

    public TyplmWorkFlowProcessServiceImpl() {
    }

    public PageInfo<FlowTaskInfo> queryMyToDoTaskPage(Map<String, Object> params, Integer curPage, Integer pageSize) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyToDoTaskPage 方法入参params ==> 【{}】; curPage ==> 【{}】; pageSize ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(params), JSONObject.toJSONString(curPage), JSONObject.toJSONString(pageSize)};
        });
        params.put("assignee", CommonUtil.getUserOid().toString());
        params.put("handleoid", CommonUtil.getUserOid());
        PageInfo<FlowTaskInfo> pageInfo = this.typlmFlowableTaskService.queryAllTaskByParams(params, curPage, pageSize);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyToDoTaskPage 查询出来的流程任务pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        this.setFlowTaskInfo(pageInfo.getList());
        this.setInteractTaskInfo(pageInfo.getList());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyToDoTaskPage 返回前的pageInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        return pageInfo;
    }

    private void setInteractTaskInfo(List<FlowTaskInfo> list) {
        if (!CollUtil.isEmpty(list)) {
            List<BigInteger> interactTaskOids = (List)list.stream().filter((task) -> {
                return ObjectUtils.isNotEmpty(task.getInteractTaskOid());
            }).map(FlowTaskInfo::getInteractTaskOid).collect(Collectors.toList());
            Map<BigInteger, List<FlowInteractTask>> interactTaskMap = this.typlmFlowInteractTaskService.queryChildInteractTask(interactTaskOids);
            List<String> taskIds = (List)list.stream().filter((task) -> {
                return "flowTask".equals(task.getTaskType());
            }).map(FlowTaskInfo::getTaskId).collect(Collectors.toList());
            Map<String, List<FlowInteractTask>> flowTaskMap = this.typlmFlowInteractTaskService.queryInteractTaskByTaskId(taskIds, CommonUtil.getUserOid());
            Iterator var6 = list.iterator();

            while(var6.hasNext()) {
                FlowTaskInfo flowTaskInfo = (FlowTaskInfo)var6.next();
                if ("flowTask".equals(flowTaskInfo.getTaskType())) {
                    flowTaskInfo.setHasInteractChild(!CollectionUtils.isEmpty((Collection)flowTaskMap.get(flowTaskInfo.getTaskId())));
                } else if ("interactTask".equals(flowTaskInfo.getTaskType())) {
                    flowTaskInfo.setHasInteractChild(!CollectionUtils.isEmpty((Collection)interactTaskMap.get(flowTaskInfo.getInteractTaskOid())));
                }
            }

        }
    }

    public PageInfo<PdmUserDTO> queryDeliverUserPageByTask(Map<String, Object> queryConditions) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 方法入参queryConditions ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(queryConditions)};
        });
        String taskId = String.valueOf(queryConditions.get("taskId"));
        Task task = this.getNonTask(taskId);
        String roleKey = this.typlmFlowElementService.getRoleKey(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 根据task获取到的roleKey <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(roleKey)};
        });
        UserTask userTask = this.typlmFlowElementService.getUserTask(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 获取到的userTask <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userTask)};
        });
        WorkFlowContainer workFlowContainer = this.typlmWorkFlowContainerService.getWorkFlowContainerByFlowableProcessId(task.getProcessInstanceId());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 获取到的workFlowContainer <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainer)};
        });
        FlowHandlerDTO flowHandlerDTO = new FlowHandlerDTO();
        flowHandlerDTO.setDeploymentId(workFlowContainer.getDeploymentId());
        flowHandlerDTO.setParentDeploymentId(workFlowContainer.getDeploymentId());
        flowHandlerDTO.setContainerOid(workFlowContainer.getContainerOid());
        flowHandlerDTO.setContainerOtype(workFlowContainer.getContainerOtype());
        flowHandlerDTO.setWorkFlowContainerOid(workFlowContainer.getOid());
        flowHandlerDTO.setTaskDefId(userTask.getId());
        flowHandlerDTO.setRoleName(roleKey);
        if (queryConditions.get("name") != null) {
            flowHandlerDTO.setQueryCondition(queryConditions.get("name").toString());
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 构造的查询条件flowHandlerDTO ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowHandlerDTO)};
        });
        PageInfo<PdmUserDTO> flowHandlerPage = this.typlmFlowHandlerService.getFlowHandlerPage(flowHandlerDTO);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 获取到的flowHandlerPage <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowHandlerPage)};
        });
        List<PdmUserDTO> list = flowHandlerPage.getList();
        if (CollUtil.isNotEmpty(list)) {
            List<PdmUserDTO> collect = (List)list.stream().filter((user) -> {
                return !TyplmWorkFlowUtil.getUserOid().toString().equals(user.getOid());
            }).collect(Collectors.toList());
            flowHandlerPage.setList(collect);
            flowHandlerPage.setTotal((long)collect.size());
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "queryDeliverUserPageByTask 返回的flowHandlerPage ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowHandlerPage)};
        });
        return flowHandlerPage;
    }

    private void setFlowTaskInfo(List<FlowTaskInfo> list) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setFlowTaskInfo 方法入参list ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(list)};
        });
        if (!CollUtil.isEmpty(list)) {
            Set<IdentifierEntity> containerSet = new HashSet();
            Set<BigInteger> userOidSet = new HashSet();
            Iterator var4 = list.iterator();

            while(var4.hasNext()) {
                FlowTaskInfo flowTaskInfo = (FlowTaskInfo)var4.next();
                this.setMoreInfo(flowTaskInfo, containerSet, userOidSet);
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "setFlowTaskInfo 任务列表里面的容器集合containerSet ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(containerSet)};
            });
            List<CTyEntityBaseDO> containerList = CommonUtil.getEntityListIgnoreNotExist(new ArrayList(containerSet));
            Map<IdentifierEntity, CTyEntityBaseDO> containerMap = TyplmEntityBaseUtil.getIdentifierToEntityMap(containerList);
            TyplmLoggerUtil.debug(log, () -> {
                return "setFlowTaskInfo 获取到的容器map集合containerMap <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(containerMap)};
            });
            Map<String, String> emergencyMap = this.typlmMultilingualExtendService.queryMultilingualByEnumDefName("ChangeUrgency");
            TyplmLoggerUtil.debug(log, () -> {
                return "setFlowTaskInfo 获取到的紧急程度枚举emergencyMap <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(emergencyMap)};
            });
            Map<BigInteger, UserDO> userMap = new HashMap();
            TyplmLoggerUtil.debug(log, () -> {
                return "setFlowTaskInfo 任务列表里面的用户id集合 ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userOidSet)};
            });
            List<UserDO> userList = this.typlmUserService.queryUserByidList(new ArrayList(userOidSet));
            TyplmLoggerUtil.debug(log, () -> {
                return "setFlowTaskInfo 获取到的用户userList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userList)};
            });
            if (CollUtil.isNotEmpty(userList)) {
                userMap.putAll((Map)userList.stream().collect(Collectors.toMap(CTyEntityBaseDO::getOid, (t) -> {
                    return t;
                }, (k1, k2) -> {
                    return k1;
                })));
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "setFlowTaskInfo 用户集合转换的userMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userMap)};
            });
            list.forEach((flowTaskInfox) -> {
                TyplmLoggerUtil.debug(log, () -> {
                    return "setFlowTaskInfo 循环里面的flowTaskInfo ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(flowTaskInfox)};
                });
                flowTaskInfox.setEmergencyDegreeName((String)emergencyMap.get(flowTaskInfox.getEmergencyDegree()));
                IdentifierEntity container = new IdentifierEntity(flowTaskInfox.getContainerOid(), flowTaskInfox.getContainerOtype());
                CTyEntityBaseDO cTyEntityBaseDO = (CTyEntityBaseDO)containerMap.get(container);
                TyplmLoggerUtil.debug(log, () -> {
                    return "setFlowTaskInfo 循环里面获取flowTaskInfo对应的容器cTyEntityBaseDO ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(cTyEntityBaseDO)};
                });
                if (Objects.nonNull(cTyEntityBaseDO)) {
                    flowTaskInfox.setContainerName(cTyEntityBaseDO.getName());
                }

                UserDO creator = (UserDO)userMap.get(flowTaskInfox.getWorkFlowContainerCreatorId());
                TyplmLoggerUtil.debug(log, () -> {
                    return "setFlowTaskInfo 循环里面获取flowTaskInfo对应的流程创建人creator ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(creator)};
                });
                if (Objects.nonNull(creator)) {
                    flowTaskInfox.setWorkFlowContainerCreatorName(creator.getFullname());
                    flowTaskInfox.setWorkFlowContainerCreatorUserName(creator.getName());
                    flowTaskInfox.setWorkFlowContainerCreatorDisplayName(TyplmEntityBaseUtil.getFullDisplayName(creator.getName(), creator.getFullname()));
                }

                UserDO preNodeUser = (UserDO)userMap.get(flowTaskInfox.getPreNodeUserOid());
                TyplmLoggerUtil.debug(log, () -> {
                    return "setFlowTaskInfo 循环里面获取flowTaskInfo对应的上一步骤执行人preNodeUser ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(preNodeUser)};
                });
                if (Objects.nonNull(preNodeUser)) {
                    flowTaskInfox.setPreNodeUserName(preNodeUser.getFullname());
                    flowTaskInfox.setPreNodeAccount(preNodeUser.getName());
                    flowTaskInfox.setNextNodeUserDisplayName(TyplmEntityBaseUtil.getFullDisplayName(preNodeUser.getName(), preNodeUser.getFullname()));
                }

                List<BigInteger> nextNodeUserOidList = flowTaskInfox.getNextNodeUserOidList();
                List<UserDO> nextNodeUserList = new ArrayList();
                if (CollUtil.isNotEmpty(nextNodeUserOidList)) {
                    nextNodeUserOidList.forEach((oid) -> {
                        UserDO userDO = (UserDO)userMap.get(oid);
                        if (Objects.nonNull(userDO)) {
                            nextNodeUserList.add(userMap.get(oid));
                        }

                    });
                }

                TyplmLoggerUtil.debug(log, () -> {
                    return "setFlowTaskInfo 循环里面获取flowTaskInfo对应的下步骤执行人nextNodeUserList ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(nextNodeUserList)};
                });
                List<String> nameList = (List)nextNodeUserList.stream().map(UserDO::getFullname).collect(Collectors.toList());
                List<String> accountList = (List)nextNodeUserList.stream().map(CTyEntityBaseDO::getName).collect(Collectors.toList());
                List<String> displayNameList = (List)nextNodeUserList.stream().map((userDO) -> {
                    return TyplmEntityBaseUtil.getFullDisplayName(userDO.getName(), userDO.getFullname());
                }).collect(Collectors.toList());
                flowTaskInfox.setNextNodeUserName(String.join(",", nameList));
                flowTaskInfox.setNextNodeAccount(String.join(",", accountList));
                flowTaskInfox.setNextNodeUserDisplayName(String.join(",", displayNameList));
                if (Objects.nonNull(flowTaskInfox.getFlowTemplateId())) {
                    WorkFlow workFlow = this.typlmWorkFlowService.getWorkFlowByWorkFlowId(flowTaskInfox.getFlowTemplateId());
                    flowTaskInfox.setWorkFlowName(workFlow.getName());
                }

            });
        }
    }

    private void setMoreInfo(FlowTaskInfo flowTaskInfo, Set<IdentifierEntity> containerSet, Set<BigInteger> userOidSet) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreInfo 方法入参flowTaskInfo ==> 【{}】; containerSet ==> 【{}】; userOidSet ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo), JSONObject.toJSONString(containerSet), JSONObject.toJSONString(userOidSet)};
        });
        String processDefId = flowTaskInfo.getProcessDefId();
        String taskDefKey = flowTaskInfo.getTaskDefKey();
        this.setExpiredFlag(flowTaskInfo);
        boolean userIsCreator = this.typlmFlowElementService.checkUserIsCreator(processDefId, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreInfo 处理人为创建人校验userIsCreator <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userIsCreator)};
        });
        flowTaskInfo.setDeliverable(!userIsCreator);
        boolean containerViewEditable = this.typlmFlowElementService.checkContainerViewEditable(processDefId, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreInfo 查看任务节点是否允许编辑containerViewEditable <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(containerViewEditable)};
        });
        flowTaskInfo.setEditable(containerViewEditable);
        boolean deliverRange = this.typlmFlowElementService.checkDeliverRange(processDefId, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreInfo 查看任务转交范围是否允许全部deliverRange <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(deliverRange)};
        });
        flowTaskInfo.setDeliverRangeAll(deliverRange);
        BigInteger workFlowContainerOid = flowTaskInfo.getWorkFlowContainerOid();
        String workFlowContainerOtype = flowTaskInfo.getWorkFlowContainerOtype();
        FlowTaskRecord flowTaskRecord = this.typlmFlowTaskRecordService.queryNewestRecordByMaster(workFlowContainerOid, workFlowContainerOtype, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreInfo 获取的最新流程处理记录flowTaskRecord <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskRecord)};
        });
        if (flowTaskRecord != null) {
            BigInteger operatorOid = flowTaskRecord.getOperatorOid();
            flowTaskInfo.setPreNodeUserOid(operatorOid);
            userOidSet.add(operatorOid);
        } else {
            flowTaskInfo.setPreNodeUserOid(flowTaskInfo.getWorkFlowContainerCreatorId());
        }

        userOidSet.add(flowTaskInfo.getWorkFlowContainerCreatorId());
        List<UserTask> nextUserTask = this.typlmFlowElementService.getNextUserTask(flowTaskInfo.getExecutionId(), processDefId);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreInfo 获取下一步的节点nextUserTask <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(nextUserTask)};
        });
        if (CollUtil.isNotEmpty(nextUserTask)) {
            Map<String, String> nextMap = (Map)nextUserTask.stream().collect(Collectors.toMap(BaseElement::getId, (userTask) -> {
                return String.valueOf(userTask.getName());
            }, (e, e1) -> {
                return e;
            }));
            flowTaskInfo.setNextNodeName(String.join(",", nextMap.values()));
            List<FlowTaskUser> flowTaskUsers = this.typlmFlowTaskUserService.queryListByTaskAndFlowContainer(nextMap.keySet(), workFlowContainerOid, workFlowContainerOtype);
            TyplmLoggerUtil.debug(log, () -> {
                return "setMoreInfo 获取下一步的节点对应的人flowTaskUsers <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowTaskUsers)};
            });
            if (CollUtil.isNotEmpty(flowTaskUsers)) {
                List<BigInteger> userIds = (List)flowTaskUsers.stream().map(FlowTaskUser::getUserOid).collect(Collectors.toList());
                flowTaskInfo.setNextNodeUserOidList(userIds);
                userOidSet.addAll(userIds);
            }
        }

        containerSet.add(new IdentifierEntity(flowTaskInfo.getContainerOid(), flowTaskInfo.getContainerOtype()));
    }

    private void setExpiredFlag(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setExpiredFlag 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        Date currentDate = new Date();
        Date taskNeedTime = flowTaskInfo.getTaskNeedTime();
        if (Objects.nonNull(taskNeedTime)) {
            flowTaskInfo.setTaskExpired(taskNeedTime.before(currentDate));
        }

        Date processNeedTime = flowTaskInfo.getNeedTime();
        if (Objects.nonNull(processNeedTime)) {
            flowTaskInfo.setProcessExpired(processNeedTime.before(currentDate));
        }

    }

    private void setNextNodeInfo(FlowTaskInfo flowTaskInfo, BigInteger workFlowContainerOid, String workFlowContainerOtype, List<UserTask> nextUserTask) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setNextNodeInfo 方法入参flowTaskInfo ==> 【{}】; workFlowContainerOid ==> 【{}】; workFlowContainerOtype ==> 【{}】; nextUserTask ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo), JSONObject.toJSONString(workFlowContainerOid), JSONObject.toJSONString(workFlowContainerOtype), JSONObject.toJSONString(nextUserTask)};
        });
        Map<String, String> nextMap = (Map)nextUserTask.stream().collect(Collectors.toMap(BaseElement::getId, (userTask) -> {
            return String.valueOf(userTask.getName());
        }, (e, e1) -> {
            return e;
        }));
        flowTaskInfo.setNextNodeName(String.join(",", nextMap.values()));
        List<FlowTaskUser> flowTaskUsers = this.typlmFlowTaskUserService.queryListByTaskAndFlowContainer(nextMap.keySet(), workFlowContainerOid, workFlowContainerOtype);
        TyplmLoggerUtil.debug(log, () -> {
            return "setNextNodeInfo 获取对应节点设置的执行人flowTaskUsers <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskUsers)};
        });
        if (!flowTaskUsers.isEmpty()) {
            List<BigInteger> userIds = (List)flowTaskUsers.stream().map(FlowTaskUser::getUserOid).collect(Collectors.toList());
            TyplmLoggerUtil.debug(log, () -> {
                return "setNextNodeInfo 对应节点设置的执行人id集合userIds ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userIds)};
            });
            List<UserDO> userListByIdList = this.typlmUserService.queryUserByidList(userIds);
            TyplmLoggerUtil.debug(log, () -> {
                return "setNextNodeInfo 获取到的用户集合userListByIdList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userListByIdList)};
            });
            List<String> nameList = (List)userListByIdList.stream().map(UserDO::getFullname).collect(Collectors.toList());
            List<String> accountList = (List)userListByIdList.stream().map(CTyEntityBaseDO::getName).collect(Collectors.toList());
            List<String> displayNameList = (List)userListByIdList.stream().map((userDO) -> {
                return userDO.getFullname() + "(" + userDO.getName() + ")";
            }).collect(Collectors.toList());
            flowTaskInfo.setNextNodeUserName(String.join(",", nameList));
            flowTaskInfo.setNextNodeAccount(String.join(",", accountList));
            flowTaskInfo.setNextNodeUserDisplayName(String.join(",", displayNameList));
        }

    }

    private Task getNonTask(String taskId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getNonTask 方法入参taskId ==> 【{}】";
        }, () -> {
            return new Object[]{taskId};
        });
        if (StringUtils.isBlank(taskId)) {
            throw SystemErrorCodeEnum.TASK_ID_NO_EXIST.getException(new Object[0]);
        } else {
            Task task = (Task)((TaskQuery)this.taskService.createTaskQuery().taskId(taskId)).singleResult();
            if (task == null) {
                throw SystemErrorCodeEnum.TASK_NO_EXIST.getException(new Object[0]);
            } else {
                return task;
            }
        }
    }

    private UserTask getUserTask(Process process, String taskDefKey) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getUserTask 方法入参process ==> 【{}】; taskDefKey ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(process), taskDefKey};
        });
        FlowElement flowElement = TyplmWorkFlowUtil.getFlowElementById(process, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "getUserTask 获取到的节点元素flowElement <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowElement)};
        });
        if (!(flowElement instanceof UserTask)) {
            throw SystemErrorCodeEnum.TASK_IS_NOT_USER_TASK.getException(new Object[0]);
        } else {
            return (UserTask)flowElement;
        }
    }

    public void setTaskRouterList(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setTaskRouterList 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        Process process = this.typlmFlowElementService.getProcessByFlowTaskInfo(flowTaskInfo);
        TyplmLoggerUtil.debug(log, () -> {
            return "setTaskRouterList 获取到的process <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(process)};
        });
        UserTask userTask = this.getUserTask(process, flowTaskInfo.getTaskDefKey());
        TyplmLoggerUtil.debug(log, () -> {
            return "setTaskRouterList 获取到的userTask <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userTask)};
        });
        String defaultFlow = userTask.getDefaultFlow();
        flowTaskInfo.setDefaultRouter(defaultFlow);
        boolean checkMultiRouterCheck = this.typlmFlowElementService.checkMultiRouterCheck(userTask);
        TyplmLoggerUtil.debug(log, () -> {
            return "setTaskRouterList 路由是否允许多选checkMultiRouterCheck <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(checkMultiRouterCheck)};
        });
        flowTaskInfo.setMultiRouterCheck(checkMultiRouterCheck);
        List<Router> routerList = this.getRouterList(userTask, process);
        TyplmLoggerUtil.debug(log, () -> {
            return "setTaskRouterList 获取到的路由routerList <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(routerList)};
        });
        flowTaskInfo.setRouterList(routerList);
        List<TargetNode> enableSetNodeList = this.getEnableSetNodeList(process, userTask, flowTaskInfo);
        TyplmLoggerUtil.debug(log, () -> {
            return "setTaskRouterList 获取可以设置参与者的其他节点enableSetNodeList <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(enableSetNodeList)};
        });
        flowTaskInfo.setTargetNodeList(enableSetNodeList);
    }

    private List<Router> getRouterList(UserTask userTask, Process process) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getRouterList 方法入参userTask ==> 【{}】; process ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userTask), JSONObject.toJSONString(process)};
        });
        List<SequenceFlow> outFlows = userTask.getOutgoingFlows();
        List<Router> routerList = new ArrayList();
        Iterator var5 = outFlows.iterator();

        while(var5.hasNext()) {
            SequenceFlow outFlow = (SequenceFlow)var5.next();
            Router router = new Router();
            String routerName = outFlow.getName();
            if (TyAccountContext.isDebug()) {
                log.info("getRouterList 路由名称routerName ==> 【{}】", routerName);
            }

            String targetRef = outFlow.getTargetRef();
            boolean checkHandlerRemark = this.typlmFlowElementService.checkHandlerRemark(outFlow);
            TyplmLoggerUtil.debug(log, () -> {
                return "getRouterList 路由是否校验处理意见checkHandlerRemark ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(checkHandlerRemark)};
            });
            FlowElement targetElement = TyplmWorkFlowUtil.getFlowElementById(process, targetRef);
            if (StringUtils.isBlank(routerName) || "\"\"".equals(routerName)) {
                routerName = targetElement.getName();
            }

            router.setLabel(routerName);
            router.setValue(outFlow.getId());
            router.setCheckHandlerRemark(checkHandlerRemark);
            router.setTarget(outFlow.getTargetFlowElement().getId());
            routerList.add(router);
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "getRouterList 返回的routerList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(routerList)};
        });
        return routerList;
    }

    private List<TargetNode> getEnableSetNodeList(Process process, UserTask userTask, FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getEnableSetNodeList 方法入参process ==> 【{}】; userTask ==> 【{}】; flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(process), JSONObject.toJSONString(userTask), JSONObject.toJSONString(flowTaskInfo)};
        });
        List<TargetNode> enableSetNodeList = new ArrayList();
        this.getEnableSetNodeByUserTask(process, userTask, enableSetNodeList, flowTaskInfo);
        TyplmLoggerUtil.debug(log, () -> {
            return "getEnableSetNodeList 返回的enableSetNodeList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(enableSetNodeList)};
        });
        return enableSetNodeList;
    }

    private void getEnableSetNodeByUserTask(Process process, UserTask userTask, List<TargetNode> enableSetNodeList, FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getEnableSetNodeByUserTask 方法入参process ==> 【{}】; userTask ==> 【{}】; enableSetNodeList ==> 【{}】; flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(process), JSONObject.toJSONString(userTask), JSONObject.toJSONString(enableSetNodeList), JSONObject.toJSONString(flowTaskInfo)};
        });
        Map<String, List<ExtensionElement>> extensionElements = userTask.getExtensionElements();
        List<ExtensionElement> participantList = (List)extensionElements.get("setparticipantproperties");
        TyplmLoggerUtil.debug(log, () -> {
            return "getEnableSetNodeByUserTask 设置参与者的配置participantList <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(participantList)};
        });
        Map<String, JSONObject> userTaskMap = new HashMap();
        this.createUserTaskMap(participantList, userTaskMap);
        TyplmLoggerUtil.debug(log, () -> {
            return "getEnableSetNodeByUserTask 获取到的配置集合userTaskMap <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userTaskMap)};
        });
        userTaskMap.entrySet().forEach((entry) -> {
            TargetNode targetNode = new TargetNode();
            String key = (String)entry.getKey();
            TyplmLoggerUtil.debug(log, () -> {
                return "getEnableSetNodeByUserTask 循环里面map的key <== 【{}】";
            }, () -> {
                return new Object[]{key};
            });
            targetNode.setId(key);
            JSONObject task = (JSONObject)entry.getValue();
            TyplmLoggerUtil.debug(log, () -> {
                return "getEnableSetNodeByUserTask 循环里面的map的值task <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(task)};
            });
            JSONObject active = task.getJSONObject("active");
            if (ObjectUtils.isNotEmpty(active)) {
                String name = active.getString("name");
                targetNode.setName(StringUtils.isNotBlank(name) ? name : "");
            }

            FlowElement flowElement = TyplmWorkFlowUtil.getFlowElementById(process, key);
            TyplmLoggerUtil.debug(log, () -> {
                return "getEnableSetNodeByUserTask 循环里面获取到的节点flowElement <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowElement)};
            });
            if (flowElement instanceof UserTask) {
                boolean needDistributeObjects = this.typlmFlowElementService.checkNeedDistributeObjects((UserTask)flowElement);
                TyplmLoggerUtil.debug(log, () -> {
                    return "getEnableSetNodeByUserTask 节点是用户任务时判断是否需要分配内容needDistributeObjects <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(needDistributeObjects)};
                });
                targetNode.setNeedDistributeObjects(needDistributeObjects);
                enableSetNodeList.add(targetNode);
            } else if (flowElement instanceof CallActivity) {
                CallActivity callActivity = (CallActivity)flowElement;
                String calledElement = callActivity.getCalledElement();
                String workflowId = calledElement.substring(1);
                WorkFlow workFlow = this.typlmWorkFlowService.getWorkFlowByWorkFlowId(new BigInteger(workflowId));
                TyplmLoggerUtil.debug(log, () -> {
                    return "getEnableSetNodeByUserTask 节点是子流程时查询绑定的流程模板workFlow <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(workFlow)};
                });
                String deploymentId = workFlow.getDeploymentId();
                WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
                BigInteger containerOid = workFlowContainerView.getContainerOid();
                String containerOtype = workFlowContainerView.getContainerOtype();
                List<UserTaskDTO> callActivityUserTask = this.typlmFlowTaskUserService.getAllUserTask(deploymentId, containerOid, containerOtype, callActivity);
                TyplmLoggerUtil.debug(log, () -> {
                    return "getEnableSetNodeByUserTask 节点是子流程时查询到的走流程节点callActivityUserTask <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(callActivityUserTask)};
                });
                Iterator var19 = callActivityUserTask.iterator();

                while(var19.hasNext()) {
                    UserTaskDTO userTaskDTO = (UserTaskDTO)var19.next();
                    TargetNode subTargetNode = new TargetNode();
                    subTargetNode.setId(userTaskDTO.getId());
                    subTargetNode.setName(userTaskDTO.getName());
                    subTargetNode.setNeedDistributeObjects(false);
                    enableSetNodeList.add(subTargetNode);
                }
            }

        });
    }

    private void createUserTaskMap(List<ExtensionElement> participantList, Map<String, JSONObject> userTaskMap) {
        TyplmLoggerUtil.debug(log, () -> {
            return "createUserTaskMap 方法入参participantList ==> 【{}】; userTaskMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(participantList), JSONObject.toJSONString(userTaskMap)};
        });
        if (!CollectionUtils.isEmpty(participantList)) {
            String elementText = ((ExtensionElement)participantList.get(0)).getElementText();
            TyplmLoggerUtil.debug(log, () -> {
                return "createUserTaskMap 获取到的配置elementText ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(elementText)};
            });
            if (StringUtils.isEmpty(elementText) || "\"\"".equals(elementText)) {
                return;
            }

            JSONObject jsonObject = JSON.parseObject(elementText);
            TyplmLoggerUtil.debug(log, () -> {
                return "createUserTaskMap 获取到的配置转换成jsonObject ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(jsonObject)};
            });
            boolean enable = jsonObject.getBoolean("isSetParticipantor");
            JSONArray jsonArray = jsonObject.getJSONArray("tableData");
            if (!enable || CollectionUtils.isEmpty(jsonArray)) {
                return;
            }

            jsonArray.forEach((item) -> {
                Boolean add = ((JSONObject)item).getBoolean("add");
                Boolean remove = ((JSONObject)item).getBoolean("remove");
                if (add && remove) {
                    JSONObject task = ((JSONObject)item).getJSONObject("active");
                    String taskId = task.getString("id");
                    userTaskMap.put(taskId, (JSONObject)item);
                }

            });
        }

    }

    public void startProcess(WorkFlowContainerView workFlowContainerView) {
        TyplmLoggerUtil.debug(log, () -> {
            return "startProcess 方法入参workFlowContainerView ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerView)};
        });
        this.startProcess(workFlowContainerView, (Map)null, false);
    }

    public void startProcess(WorkFlowContainerView workFlowContainerView, boolean throwFlag) {
        TyplmLoggerUtil.debug(log, () -> {
            return "startProcess 方法入参workFlowContainerView ==> 【{}】; throwFlag ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerView), JSONObject.toJSONString(throwFlag)};
        });
        this.startProcess(workFlowContainerView, (Map)null, throwFlag);
    }

    public void startProcess(WorkFlowContainerView workFlowContainerView, Map<String, Object> extParams, boolean throwFlag) {
        TyplmLoggerUtil.debug(log, () -> {
            return "startProcess 方法入参workFlowContainerView ==> 【{}】; extParams ==> 【{}】; throwFlag ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerView), JSONObject.toJSONString(extParams), JSONObject.toJSONString(throwFlag)};
        });
        if (workFlowContainerView == null) {
            throw SystemErrorCodeEnum.WORK_FLOW_NO_START_EVENT.getException(new Object[0]);
        } else {
            this.typlmWorkFlowContainerService.checkContainerEnableStart(workFlowContainerView, throwFlag);
            TyplmLoggerUtil.debug(log, () -> {
                return "startProcess 流程是否能启动workFlowContainerView.getEnableStart() ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(workFlowContainerView.getEnableStart())};
            });
            if (!Boolean.FALSE.equals(workFlowContainerView.getEnableStart())) {
                Map<String, Object> params = new HashMap(16);
                List<UserTaskDTO> userTaskList = workFlowContainerView.getUserTaskList();
                this.validateParticipantExistInReuiredUserTask(userTaskList);

                UserTaskDTO userTask;
                Object collect;
                for(Iterator var6 = userTaskList.iterator(); var6.hasNext(); params.put(userTask.getId().replace("-", "") + "list", collect)) {
                    userTask = (UserTaskDTO)var6.next();
                    List<PdmUserDTO> userList = userTask.getUserList();
                    collect = new HashSet();
                    if (!CollectionUtils.isEmpty(userList)) {
                        collect = (Set)userList.stream().map(PdmUserDTO::getOid).collect(Collectors.toSet());
                    }
                }

                params.put("workFlowContainerId", workFlowContainerView.getOid());
                params.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true);
                if (!CollectionUtils.isEmpty(extParams)) {
                    params.putAll(extParams);
                }

                String deploymentId = workFlowContainerView.getDeploymentId();
                ProcessDefinition processDefinition = (ProcessDefinition)this.repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
                if (processDefinition == null) {
                    throw SystemErrorCodeEnum.PROCESS_DEF_NO_EXIST.getException(new Object[0]);
                } else {
                    String processDefinitionId = processDefinition.getId();

                    try {
                        TyplmLoggerUtil.debug(log, () -> {
                            return "startProcess 启动前的组装的参数params ==> 【{}】";
                        }, () -> {
                            return new Object[]{JSONObject.toJSONString(params)};
                        });
                        this.identityService.setAuthenticatedUserId(TyplmWorkFlowUtil.getUser().getOid().toString());
                        ProcessInstance processInstance = this.runtimeService.startProcessInstanceById(processDefinitionId, workFlowContainerView.getOid().toString(), params);
                        String processInstanceId = processInstance.getId();
                        workFlowContainerView.setFlowableProcessId(processInstanceId);
                        WorkFlowContainer dbWorkFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowContainerView.getOid());
                        TyplmLoggerUtil.debug(log, () -> {
                            return "startProcess 查询一下数据库的流程容器dbWorkFlowContainer <== 【{}】";
                        }, () -> {
                            return new Object[]{JSONObject.toJSONString(dbWorkFlowContainer)};
                        });
                        Date date = new Date();
                        if (!workFlowContainerView.getStatus().equals(dbWorkFlowContainer.getStatus())) {
                            workFlowContainerView.setUpdatestamp(date);
                            workFlowContainerView.setStatus(dbWorkFlowContainer.getStatus());
                            workFlowContainerView.setUpdatecount(dbWorkFlowContainer.getUpdatecount());
                        } else {
                            workFlowContainerView.setStatus(WorkFlowContainerStatusEnum.PROCESSING.getValue());
                        }

                        workFlowContainerView.setStartStamp(date);
                        workFlowContainerView.setNeedDate(dbWorkFlowContainer.getNeedDate());
                        this.typlmWorkFlowContainerService.update(workFlowContainerView);
                        this.typlmFlowContainerObjectService.handleStartFlowContainerObject(workFlowContainerView);
                        TyplmLoggerUtil.debug(log, () -> {
                            return "startProcess 更新完的workFlowContainerView ==> 【{}】";
                        }, () -> {
                            return new Object[]{JSONObject.toJSONString(workFlowContainerView)};
                        });
                    } catch (FlowableIllegalArgumentException var16) {
                        this.handleFlowableException(processDefinitionId, var16);
                    } finally {
                        this.identityService.setAuthenticatedUserId((String)null);
                    }

                }
            }
        }
    }

    private void validateParticipantExistInReuiredUserTask(List<UserTaskDTO> userTaskList) {
        if (!org.apache.commons.collections4.CollectionUtils.isEmpty(userTaskList)) {
            List<UserTaskDTO> requiredUserTaskWithoutParticipants = (List)userTaskList.stream().filter((userTaskDTOx) -> {
                return StringUtils.equals("1", userTaskDTOx.getParticipantStrategy()) && org.apache.commons.collections4.CollectionUtils.isEmpty(userTaskDTOx.getUserList());
            }).collect(Collectors.toList());
            if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(requiredUserTaskWithoutParticipants)) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("[");

                for(int i = 0; i < requiredUserTaskWithoutParticipants.size(); ++i) {
                    UserTaskDTO userTaskDTO = (UserTaskDTO)requiredUserTaskWithoutParticipants.get(i);
                    stringBuilder.append(userTaskDTO.getName()).append("用户任务");
                    if (i != requiredUserTaskWithoutParticipants.size() - 1) {
                        stringBuilder.append(",");
                    }
                }

                stringBuilder.append("]");
                throw WorkFlowErrorCodeEnum.WORK_FLOW_USERTASK_NO_PARTICIPANT.getException(new Object[]{stringBuilder.toString()});
            }
        }
    }

    public void startProcessQuick(WorkFlowContainerView workFlowContainerView) {
        TyplmLoggerUtil.debug(log, () -> {
            return "startProcessQuick 方法入参workFlowContainerView ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerView)};
        });
        Map<String, Object> params = new HashMap(16);
        params.put("workFlowContainerId", workFlowContainerView.getOid());
        params.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true);
        String deploymentId = workFlowContainerView.getDeploymentId();
        ProcessDefinition processDefinition = (ProcessDefinition)this.repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
        if (processDefinition == null) {
            throw SystemErrorCodeEnum.PROCESS_DEF_NO_EXIST.getException(new Object[0]);
        } else {
            String processDefinitionId = processDefinition.getId();

            try {
                TyplmLoggerUtil.debug(log, () -> {
                    return "startProcessQuick 启动前的组装的参数params ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(params)};
                });
                this.identityService.setAuthenticatedUserId(TyplmWorkFlowUtil.getUser().getOid().toString());
                ProcessInstance processInstance = this.runtimeService.startProcessInstanceById(processDefinitionId, workFlowContainerView.getOid().toString(), params);
                String processInstanceId = processInstance.getId();
                workFlowContainerView.setFlowableProcessId(processInstanceId);
                WorkFlowContainer dbWorkFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowContainerView.getOid());
                TyplmLoggerUtil.debug(log, () -> {
                    return "startProcessQuick 查询一下数据库的流程容器dbWorkFlowContainer <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(dbWorkFlowContainer)};
                });
                if (!workFlowContainerView.getStatus().equals(dbWorkFlowContainer.getStatus())) {
                    workFlowContainerView.setUpdatestamp(new Date());
                    workFlowContainerView.setStatus(dbWorkFlowContainer.getStatus());
                    workFlowContainerView.setUpdatecount(dbWorkFlowContainer.getUpdatecount());
                } else {
                    workFlowContainerView.setStatus(WorkFlowContainerStatusEnum.PROCESSING.getValue());
                }

                workFlowContainerView.setNeedDate(dbWorkFlowContainer.getNeedDate());
                this.typlmWorkFlowContainerService.update(workFlowContainerView);
                this.typlmFlowContainerObjectService.handleStartFlowContainerObject(workFlowContainerView);
                TyplmLoggerUtil.debug(log, () -> {
                    return "startProcessQuick 更新完的workFlowContainerView ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(workFlowContainerView)};
                });
            } catch (FlowableIllegalArgumentException var12) {
                this.handleFlowableException(processDefinitionId, var12);
            } finally {
                this.identityService.setAuthenticatedUserId((String)null);
            }

        }
    }

    private void handleFlowableException(String processDefinitionId, FlowableIllegalArgumentException flowableIllegalArgumentException) {
        TyplmLoggerUtil.debug(log, () -> {
            return "handleFlowableException 方法入参processDefinitionId ==> 【{}】; flowableIllegalArgumentException ==> 【{}】";
        }, () -> {
            return new Object[]{processDefinitionId, JSONObject.toJSONString(flowableIllegalArgumentException)};
        });
        String message = flowableIllegalArgumentException.getMessage();
        log.error(message, flowableIllegalArgumentException);
        if (!message.contains("list")) {
            throw flowableIllegalArgumentException;
        } else if (!message.contains("'")) {
            throw WorkFlowErrorCodeEnum.FLOW_EXCEPTION.getException(new Object[]{message});
        } else {
            message = message.substring(message.indexOf("'") + 1);
            message = message.substring(0, message.lastIndexOf("'"));
            String assignee = message.replace("list", "");
            UserTask userTask = this.typlmFlowElementService.getUserTaskByAssignee(processDefinitionId, assignee);
            if (userTask == null) {
                throw WorkFlowErrorCodeEnum.FLOW_EXCEPTION.getException(new Object[]{message});
            } else {
                throw SystemErrorCodeEnum.USER_TASK_MUST_BE_SET.getException(new Object[]{userTask.getName()});
            }
        }
    }

    public FlowTaskInfo getTaskDetailView(String taskId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getTaskDetailView 方法入参taskId ==> 【{}】";
        }, () -> {
            return new Object[]{taskId};
        });
        Task task = (Task)((TaskQuery)this.taskService.createTaskQuery().taskId(taskId)).singleResult();
        if (task == null) {
            HistoricTaskInstance historicTaskInstance = (HistoricTaskInstance)((HistoricTaskInstanceQuery)this.historyService.createHistoricTaskInstanceQuery().taskId(taskId)).singleResult();
            if (historicTaskInstance != null) {
                throw SystemErrorCodeEnum.TASK_COMPLETED.getException(new Object[]{historicTaskInstance.getName()});
            } else {
                throw SystemErrorCodeEnum.TASK_COMPLETED.getException(new Object[0]);
            }
        } else {
            String processInstanceId = task.getProcessInstanceId();
            WorkFlowContainer workFlowContainer = this.typlmWorkFlowContainerService.getWorkFlowContainerByFlowableProcessId(processInstanceId);
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 根据processInstanceId获取到的workFlowContainer <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(workFlowContainer)};
            });
            FlowTaskInfo flowTaskInfo = this.getFlowTaskInfo(task, workFlowContainer);
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取到的flowTaskInfo <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
            });
            flowTaskInfo.setFlowableProcessId(processInstanceId);
            WorkFlowContainerView workFlowContainerView = this.typlmWorkFlowContainerService.getWorkFlowContainerDetailByWorkFlowContainer(workFlowContainer, flowTaskInfo);
            this.removeUnnecessaryUserTask(workFlowContainerView, flowTaskInfo);
            Process process = this.typlmFlowElementService.getProcessByFlowTaskInfo(flowTaskInfo);
            UserTask userTask = this.getUserTask(process, flowTaskInfo.getTaskDefKey());
            Map<String, List<ExtensionElement>> extensionElements = userTask.getExtensionElements();
            List<ExtensionElement> participantList = (List)extensionElements.get("setparticipantproperties");
            Map<String, JSONObject> userTaskMap = new HashMap();
            this.createUserTaskMap(participantList, userTaskMap);
            List<UserTaskDTO> userTasks = workFlowContainerView.getUserTaskList();
            if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(userTasks)) {
                userTasks.forEach((userTaskDTO) -> {
                    JSONObject jsonObject = (JSONObject)userTaskMap.get(userTaskDTO.getId());
                    if (jsonObject != null) {
                        userTaskDTO.setParticipantStrategy(jsonObject.getString("participantstrategy"));
                    }

                });
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取到的workFlowContainerView <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(workFlowContainerView)};
            });
            flowTaskInfo.setWorkFlowContainerView(workFlowContainerView);
            this.typlmFlowProcessExtendService.populateGrantedProperty(workFlowContainerView, task);
            List<FlowVariableDTO> flowVariableDTOList = this.getFlowVariableList(workFlowContainerView, flowTaskInfo);
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取到的流程变量flowVariableDTOList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowVariableDTOList)};
            });
            flowTaskInfo.setFlowVariableDTOList(flowVariableDTOList);
            this.setTaskRouterList(flowTaskInfo);
            Object remark = this.taskService.getVariable(taskId, "remark");
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取路由是否校验处理意见remark <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(remark)};
            });
            if (ObjectUtils.isNotEmpty(remark)) {
                flowTaskInfo.setRemark(remark.toString());
            }

            Object routerCheck = this.taskService.getVariable(taskId, "routerCheck");
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取保存的已经选择的路由routerCheck <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(routerCheck)};
            });
            if (ObjectUtils.isNotEmpty(routerCheck)) {
                List<String> checkedRouter = Arrays.asList(routerCheck.toString().split(","));
                flowTaskInfo.setRouterCheckList(checkedRouter);
            }

            return flowTaskInfo;
        }
    }

    private void setConstraintUserTaskParticipantstrategy(List<UserTaskDTO> userTaskDTOList, FlowTaskInfo flowTaskInfo) {
        UserTask userTask = this.typlmFlowElementService.getUserTask(flowTaskInfo.getProcessDefId(), flowTaskInfo.getTaskDefKey());
        Iterator var4 = userTaskDTOList.iterator();

        while(var4.hasNext()) {
            UserTaskDTO userTaskDTO = (UserTaskDTO)var4.next();
            if (!StringUtils.equals(userTask.getId(), userTaskDTO.getId()) && ObjectUtils.isNotEmpty(userTask)) {
                this.setParticipantStrategy(userTaskDTO, userTask);
            }
        }

    }

    private void setParticipantStrategy(UserTaskDTO userTaskDTO, FlowElement flowElement) {
        Map<String, List<ExtensionElement>> extensionElements = flowElement.getExtensionElements();
        List<ExtensionElement> setparticipantproperties = (List)extensionElements.get("setparticipantproperties");
        if (!org.apache.commons.collections4.CollectionUtils.isEmpty(setparticipantproperties)) {
            String elementText = ((ExtensionElement)setparticipantproperties.get(0)).getElementText();
            JSONObject jsonObject = JSONObject.parseObject(elementText);
            if (!ObjectUtils.isEmpty(jsonObject)) {
                JSONArray tableData = jsonObject.getJSONArray("tableData");
                if (tableData != null) {
                    for(int i = 0; i < tableData.size(); ++i) {
                        JSONObject tableDataJSONObject = tableData.getJSONObject(i);
                        JSONObject active = tableDataJSONObject.getJSONObject("active");
                        if (StringUtils.equals(userTaskDTO.getId(), active.getString("id"))) {
                            userTaskDTO.setParticipantStrategy(tableDataJSONObject.getString("participantstrategy"));
                        }
                    }
                }

            }
        }
    }

    private void removeUnnecessaryUserTask(WorkFlowContainerView workFlowContainerView, FlowTaskInfo flowTaskInfo) {
        this.setConstraintUserTaskParticipantstrategy(workFlowContainerView.getUserTaskList(), flowTaskInfo);
        workFlowContainerView.setUserTaskList((List)workFlowContainerView.getUserTaskList().stream().filter((userTaskDTO) -> {
            return !StringUtils.equals("2", userTaskDTO.getParticipantStrategy());
        }).collect(Collectors.toList()));
    }

    private List<FlowVariableDTO> getFlowVariableList(WorkFlowContainerView workFlowContainerView, FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowVariableList 方法入参workFlowContainerView ==> 【{}】; flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerView), JSONObject.toJSONString(flowTaskInfo)};
        });
        if (workFlowContainerView == null) {
            return Collections.emptyList();
        } else {
            List<FlowVariableDTO> flowVariableDTOList = this.typlmFlowElementService.getFlowVariable(workFlowContainerView.getDeploymentId());
            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowVariableList 根椐部署id获取流程变量flowVariableDTOList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowVariableDTOList)};
            });
            Map<String, Object> variableMap = this.taskService.getVariables(flowTaskInfo.getTaskId());
            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowVariableList 获取流程变量值variableMap <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(variableMap)};
            });
            if (!CollectionUtils.isEmpty(flowVariableDTOList)) {
                flowVariableDTOList.forEach((item) -> {
                    item.setValue(variableMap.get(item.getVariableName()));
                    String editableNode = item.getEditableNode();
                    if (StringUtils.isNotBlank(editableNode)) {
                        List<String> nodeList = Arrays.asList(StringUtils.split(item.getEditableNode(), ","));
                        item.setEditable(!CollectionUtils.isEmpty(nodeList) && nodeList.contains(flowTaskInfo.getTaskDefKey()));
                    } else {
                        item.setEditable(Boolean.FALSE);
                    }

                });
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowVariableList 返回的流程变量集合flowVariableDTOList ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowVariableDTOList)};
            });
            return flowVariableDTOList;
        }
    }

    public FlowTaskInfo getFlowTaskInfo(TaskInfo task, WorkFlowContainer workFlowContainer) {
        FlowTaskInfo flowTaskInfo = new FlowTaskInfo();
        flowTaskInfo.setTaskId(task.getId());
        flowTaskInfo.setTaskDefKey(task.getTaskDefinitionKey());
        flowTaskInfo.setTaskName(task.getName());
        flowTaskInfo.setProcessDefId(task.getProcessDefinitionId());
        flowTaskInfo.setFlowType(workFlowContainer.getType());
        BigInteger workFlowContainerOid = workFlowContainer.getOid();
        flowTaskInfo.setWorkFlowContainerOid(workFlowContainerOid);
        flowTaskInfo.setWorkFlowContainerName(workFlowContainer.getName());
        flowTaskInfo.setTaskCreateTime(task.getCreateTime());
        Map<String, String> emergencyMap = this.typlmMultilingualExtendService.queryMultilingualByEnumDefName("ChangeUrgency");
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 获取到的紧急程度枚举emergencyMap <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(emergencyMap)};
        });
        if (!CollectionUtils.isEmpty(emergencyMap)) {
            flowTaskInfo.setEmergencyDegreeName((String)emergencyMap.get(workFlowContainer.getEmergencyDegree()));
        }

        String assignee = task.getAssignee();
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 任务的处理人assignee ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(assignee)};
        });
        if (StringUtils.isNotBlank(assignee)) {
            BigInteger assBigInteger = new BigInteger(assignee);
            PdmUser userByOid = this.pdmUserService.getUserByOid(assBigInteger);
            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowTaskInfo 获取到的用户信息userByOid <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userByOid)};
            });
            flowTaskInfo.setCurrentUser(userByOid.getFullname());
            flowTaskInfo.setCurrentAccount(userByOid.getName());
        }

        PdmUser user = this.pdmUserService.getUserByOid(workFlowContainer.getCreatorOid());
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 获取到的创建人用户信息user <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(user)};
        });
        flowTaskInfo.setWorkFlowContainerCreatorName(user.getFullname());
        flowTaskInfo.setWorkFlowContainerCreatorUserName(user.getName());
        boolean userIsCreator = this.typlmFlowElementService.checkUserIsCreator(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 处理人为创建人校验userIsCreator <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userIsCreator)};
        });
        flowTaskInfo.setDeliverable(!userIsCreator);
        boolean containerViewEditable = this.typlmFlowElementService.checkContainerViewEditable(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 任务节点是否允许编辑containerViewEditable <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(containerViewEditable)};
        });
        flowTaskInfo.setEditable(containerViewEditable);
        boolean enableCreateChange = this.typlmFlowElementService.checkEnableCreateChange(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 任务节点是否允许新建变更enableCreateChange <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(enableCreateChange)};
        });
        flowTaskInfo.setEnableCreateChange(enableCreateChange);
        boolean deliverRange = this.typlmFlowElementService.checkDeliverRange(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 查看任务转交范围是否允许全部deliverRange <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(deliverRange)};
        });
        flowTaskInfo.setDeliverRangeAll(deliverRange);
        String workFlowContainerOtype = workFlowContainer.getOtype();
        FlowTaskRecord flowTaskRecord = this.typlmFlowTaskRecordService.queryNewestRecordByMaster(workFlowContainerOid, workFlowContainerOtype, task.getTaskDefinitionKey());
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 最新的流程处理记录flowTaskRecord <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskRecord)};
        });
        if (flowTaskRecord != null) {
            BigInteger operatorOid = flowTaskRecord.getOperatorOid();
            PdmUser pdmUser = this.pdmUserService.getUserByOid(operatorOid);
            flowTaskInfo.setPreNodeUserName(pdmUser.getFullname());
            flowTaskInfo.setPreNodeAccount(pdmUser.getName());
        } else {
            flowTaskInfo.setPreNodeUserName(user.getFullname());
            flowTaskInfo.setPreNodeAccount(user.getName());
        }

        List<UserTask> nextUserTask = this.typlmFlowElementService.getNextUserTask(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowTaskInfo 下一步的节点nextUserTask <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(nextUserTask)};
        });
        if (nextUserTask.isEmpty()) {
            return flowTaskInfo;
        } else {
            this.setNextNodeInfo(flowTaskInfo, workFlowContainerOid, workFlowContainerOtype, nextUserTask);
            return flowTaskInfo;
        }
    }

    public void completeTask(FlowTaskInfo flowTaskInfo, List<MultipartFile> fileList) {
        TyplmLoggerUtil.debug(log, () -> {
            return "completeTask 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        this.completeTask(flowTaskInfo, fileList, true);
    }

    private void saveFlowVariable(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "saveFlowVariable 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        String taskId = flowTaskInfo.getTaskId();
        WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
        List<FlowVariableDTO> variableList = flowTaskInfo.getFlowVariableDTOList();
        if (!CollectionUtils.isEmpty(variableList)) {
            List<FlowVariableDTO> flowVariableDTOList = this.getFlowVariableList(workFlowContainerView, flowTaskInfo);
            TyplmLoggerUtil.debug(log, () -> {
                return "saveFlowVariable 从数据库中流程变量flowVariableDTOList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowVariableDTOList)};
            });
            if (CollectionUtils.isEmpty(flowVariableDTOList)) {
                return;
            }

            flowVariableDTOList.stream().filter((item) -> {
                return item.getEditable();
            }).forEach((item) -> {
                FlowVariableDTO flowVariableDTO = (FlowVariableDTO)variableList.stream().filter((variable) -> {
                    return StringUtils.equals(variable.getVariableName(), item.getVariableName());
                }).findFirst().orElse(null);
                TyplmLoggerUtil.debug(log, () -> {
                    return "saveFlowVariable 循环可编辑的变量flowVariableDTO <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(flowVariableDTO)};
                });
                if (flowVariableDTO != null) {
                    if (Objects.isNull(item.getValue()) || !item.getValue().equals(flowVariableDTO.getValue())) {
                        TyplmLoggerUtil.debug(log, () -> {
                            return "saveFlowVariable 更新的变量名flowVariableDTO.getVariableName() ==> 【{}】;更新后的变量的值flowVariableDTO.getValue() ==> 【{}】";
                        }, () -> {
                            return new Object[]{JSONObject.toJSONString(flowVariableDTO.getVariableName()), JSONObject.toJSONString(flowVariableDTO.getValue())};
                        });
                        this.taskService.setVariable(taskId, flowVariableDTO.getVariableName(), flowVariableDTO.getValue());
                    }

                }
            });
        }

    }

    private void setRouterChoose(FlowElement targetFlowElement, FlowTaskInfo flowTaskInfo, String taskId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setRouterChoose 方法入参targetFlowElement ==> 【{}】; flowTaskInfo ==> 【{}】; taskId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(targetFlowElement), JSONObject.toJSONString(flowTaskInfo), taskId};
        });
        if (targetFlowElement instanceof UserTask) {
            UserTask userTask = (UserTask)targetFlowElement;
            boolean needDistributeObjects = this.typlmFlowElementService.checkNeedDistributeObjects(userTask);
            TyplmLoggerUtil.debug(log, () -> {
                return "setRouterChoose 目标节点用户任务的时候判断是否需要分配任务needDistributeObjects <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(needDistributeObjects)};
            });
            if (needDistributeObjects) {
                this.typlmWorkFlowContainerViewService.handleNeedDistributeObject(userTask, flowTaskInfo);
            }
        } else if (targetFlowElement instanceof Gateway) {
            Gateway gateway = (Gateway)targetFlowElement;
            Map<String, UserTaskDTO> taskUserMap = this.getTaskUserMap(flowTaskInfo);
            TyplmLoggerUtil.debug(log, () -> {
                return "setRouterChoose 户任务节点taskUserMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(taskUserMap)};
            });
            List<SequenceFlow> outgoingFlows = gateway.getOutgoingFlows();
            Process process = this.typlmFlowElementService.getProcessByFlowTaskInfo(flowTaskInfo);
            TyplmLoggerUtil.debug(log, () -> {
                return "setRouterChoose 目标节点为网关时获取的process <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(process)};
            });
            Iterator var8 = outgoingFlows.iterator();

            while(true) {
                while(var8.hasNext()) {
                    SequenceFlow gatewaySequenceFlow = (SequenceFlow)var8.next();
                    String gatewayTargetRef = gatewaySequenceFlow.getTargetRef();
                    FlowElement gatewayTargetFlowElement = TyplmWorkFlowUtil.getFlowElementById(process, gatewayTargetRef);
                    TyplmLoggerUtil.debug(log, () -> {
                        return "setRouterChoose 网关的目标节点gatewayTargetFlowElement <== 【{}】";
                    }, () -> {
                        return new Object[]{JSONObject.toJSONString(gatewayTargetFlowElement)};
                    });
                    if (!(gatewayTargetFlowElement instanceof UserTask)) {
                        if (gatewayTargetFlowElement instanceof CallActivity) {
                            String routerChooseKey = CountHandler.getTotalKey(gatewayTargetFlowElement) + "Choose";
                            this.taskService.setVariable(taskId, routerChooseKey, true);
                        }

                        if (gatewayTargetFlowElement instanceof Gateway) {
                            this.setRouterChoose(gatewayTargetFlowElement, flowTaskInfo, taskId);
                        }
                    } else {
                        UserTask userTask = (UserTask)gatewayTargetFlowElement;
                        boolean hasUser = false;
                        Map<String, UserTaskDTO> userTaskDTOMap = this.buildUserTaskMapFromDataBase(flowTaskInfo, taskId);
                        UserTaskDTO userTaskDTO = ObjectUtils.isNotEmpty(taskUserMap.get(userTask.getId())) ? (UserTaskDTO)taskUserMap.get(userTask.getId()) : (UserTaskDTO)userTaskDTOMap.get(userTask.getId());
                        TyplmLoggerUtil.debug(log, () -> {
                            return "setRouterChoose 网关的目标节点用户任务userTaskDTO ==> 【{}】";
                        }, () -> {
                            return new Object[]{JSONObject.toJSONString(userTaskDTO)};
                        });
                        List<PdmUserDTO> userList = userTaskDTO.getUserList();
                        if (ObjectUtils.isNotEmpty(userList)) {
                            hasUser = true;
                        }

                        if (TyAccountContext.isDebug()) {
                            log.info("setRouterChoose 网关的目标节点用户任务的时候判断用户节点是否配置了人员hasUser ==> 【{}】", JSONObject.toJSONString(hasUser));
                        }

                        boolean hasDistribute = false;
                        boolean needDistributeObjects = this.typlmFlowElementService.checkNeedDistributeObjects(userTask);
                        TyplmLoggerUtil.debug(log, () -> {
                            return "setRouterChoose 网关的目标节点用户任务的时候判断是否需要分配任务needDistributeObjects <== 【{}】";
                        }, () -> {
                            return new Object[]{JSONObject.toJSONString(needDistributeObjects)};
                        });
                        if (needDistributeObjects) {
                            hasDistribute = this.typlmWorkFlowContainerViewService.checkNeedDistributeObject(userTask, flowTaskInfo);
                            if (TyAccountContext.isDebug()) {
                                log.info("setRouterChoose 网关的目标节点用户任务的时候判断需要分配处理内容的节点是否分配了处理内容hasDistribute <== 【{}】", JSONObject.toJSONString(hasDistribute));
                            }

                            if (hasDistribute && !hasUser) {
                                throw SystemErrorCodeEnum.WORK_FLOW_HAS_NO_PERSONNEL_SET.getException(new Object[]{userTask.getName()});
                            }
                        } else {
                            hasDistribute = true;
                        }

                        String routerChooseKey = CountHandler.getTotalKey(gatewayTargetFlowElement) + "Choose";
                        if (TyAccountContext.isDebug()) {
                            log.info("setRouterChoose 更新的变量名routerChooseKey ==> 【{}】;更新后的变量的值hasDistribute && hasUser ==> 【{}】", routerChooseKey, JSONObject.toJSONString(hasDistribute && hasUser));
                        }

                        this.taskService.setVariable(taskId, routerChooseKey, hasDistribute && hasUser);
                    }
                }

                return;
            }
        }

    }

    private Map<String, UserTaskDTO> buildUserTaskMapFromDataBase(FlowTaskInfo flowTaskInfo, String taskId) {
        Task task = (Task)((TaskQuery)this.taskService.createTaskQuery().taskId(taskId)).singleResult();
        String processInstanceId = task.getProcessInstanceId();
        WorkFlowContainer workFlowContainer = this.typlmWorkFlowContainerService.getWorkFlowContainerByFlowableProcessId(processInstanceId);
        WorkFlowContainerView workFlowContainerView = this.typlmWorkFlowContainerService.getWorkFlowContainerDetailByWorkFlowContainer(workFlowContainer, flowTaskInfo);
        List<UserTaskDTO> userTaskList = workFlowContainerView.getUserTaskList();
        Map<String, UserTaskDTO> taskUserMap = new HashMap();
        Iterator var9 = userTaskList.iterator();

        while(true) {
            List children;
            do {
                if (!var9.hasNext()) {
                    return taskUserMap;
                }

                UserTaskDTO userTaskDTO = (UserTaskDTO)var9.next();
                taskUserMap.put(userTaskDTO.getId(), userTaskDTO);
                children = userTaskDTO.getChildren();
            } while(CollectionUtils.isEmpty(children));

            Iterator var12 = children.iterator();

            while(var12.hasNext()) {
                UserTaskDTO child = (UserTaskDTO)var12.next();
                taskUserMap.put(child.getId(), child);
            }
        }
    }

    public void saveTask(FlowTaskInfo flowTaskInfo, List<MultipartFile> fileList) {
        TyplmLoggerUtil.debug(log, () -> {
            return "saveTask 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        String taskId = flowTaskInfo.getTaskId();
        WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
        this.typlmWorkFlowContainerService.updateByFlowTaskInfo(flowTaskInfo, fileList);
        List<String> routerCheckList = flowTaskInfo.getRouterCheckList();
        this.taskService.setVariable(taskId, "routerCheck", CollectionUtils.isEmpty(routerCheckList) ? "" : StringUtils.join(routerCheckList.toArray(), ","));
        this.saveFlowVariable(flowTaskInfo);
        String remark = flowTaskInfo.getRemark();
        this.taskService.setVariable(taskId, "remark", StringUtils.isNotBlank(remark) ? remark : "");
        this.typlmFlowTaskUserService.updateUserTaskList(workFlowContainerView);
    }

    public void dealUserTask(Task task, List<UserTaskDTO> userTaskList) {
        Iterator var3 = userTaskList.iterator();

        while(var3.hasNext()) {
            UserTaskDTO userTask = (UserTaskDTO)var3.next();
            String currentTaskId = userTask.getId();
            if (!StringUtils.isBlank(currentTaskId)) {
                String variableKey = userTask.getId().replace("-", "") + "list";
                TyplmLoggerUtil.debug(log, () -> {
                    return "dealUserTask 根据用户任务节点id得到variableKey ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(variableKey)};
                });
                List<PdmUserDTO> userList = userTask.getUserList();
                TyplmLoggerUtil.debug(log, () -> {
                    return "dealUserTask 用户任务节点设置的人员userList ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(userList)};
                });
                List<UserTaskDTO> children = userTask.getChildren();
                TyplmLoggerUtil.debug(log, () -> {
                    return "dealUserTask 用户任务节点的子节点children ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(children)};
                });
                if (ObjectUtils.isNotEmpty(children)) {
                    this.dealUserTask(task, children);
                }

                Set<String> collect = new HashSet();
                if (!CollectionUtils.isEmpty(userList)) {
                    collect.addAll((Collection)userList.stream().map(PdmUserDTO::getOid).collect(Collectors.toSet()));
                } else {
                    Object collectInVar = this.taskService.getVariable(task.getId(), variableKey);
                    if (collectInVar instanceof Collection) {
                        collect.addAll((Collection)collectInVar);
                    }
                }

                TyplmLoggerUtil.debug(log, () -> {
                    return "dealUserTask 用户任务节人员id集合collect ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(collect)};
                });
                if (collect.isEmpty()) {
                    this.taskService.removeVariable(task.getId(), variableKey);
                } else {
                    this.taskService.setVariable(task.getId(), variableKey, collect);
                }
            }
        }

    }

    private void dealVariableByStrategy(Task task, WorkFlowContainerView workFlowContainerView, List<String> routerCheckList) {
        UserTask userTask = this.typlmFlowElementService.getUserTask(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
        TyplmLoggerUtil.debug(log, () -> {
            return "dealVariableByStrategy 获取到的userTask <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userTask)};
        });
        int total = Integer.parseInt(this.taskService.getVariable(task.getId(), "nrOfCompletedInstances").toString());
        if (TyAccountContext.isDebug()) {
            log.info("dealVariableByStrategy 获取到的total <== 【{}】", JSONObject.toJSONString(total));
        }

        String id = userTask.getId();
        TaskService var10000 = this.taskService;
        String var10001 = task.getId();
        String var10002 = CountHandler.getTotalKey(id + "Completed");
        ++total;
        var10000.setVariable(var10001, var10002, total);
        ExecutionStrategyDTO executionStrategy = this.typlmFlowElementService.getUserTaskExecutionStrategy(task);
        TyplmLoggerUtil.debug(log, () -> {
            return "dealVariableByStrategy 获取到的策略executionStrategy <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(executionStrategy)};
        });
        String name = executionStrategy.getName();
        TyplmLoggerUtil.debug(log, () -> {
            return "dealVariableByStrategy 策略名称name ==> 【{}】";
        }, () -> {
            return new Object[]{name};
        });
        if ("全票通过".equals(name)) {
            this.dealVariableStrategyAll(userTask, task);
        } else if ("一票决策".equals(name)) {
            this.dealVariableStrategyOne(userTask, task, workFlowContainerView, routerCheckList, executionStrategy);
        } else if (!"票数百分比".equals(name) && "无策略".equals(name)) {
            this.dealVariableStrategyNone(userTask, task, workFlowContainerView, routerCheckList);
        }

    }

    private void dealVariableStrategyAll(UserTask userTask, Task task) {
        List<SequenceFlow> outgoingFlows = userTask.getOutgoingFlows();
        if (CollUtil.isNotEmpty(outgoingFlows)) {
            boolean multiChooseFlag = false;
            int chooseCount = 0;
            Iterator var6 = outgoingFlows.iterator();

            while(var6.hasNext()) {
                SequenceFlow sequenceFlow = (SequenceFlow)var6.next();
                String sequenceFlowId = sequenceFlow.getId();
                TyplmLoggerUtil.debug(log, () -> {
                    return "dealVariableStrategyAll 路由sequenceFlowId ==> 【{}】; ";
                }, () -> {
                    return new Object[]{sequenceFlowId};
                });
                String routerCountKey = CountHandler.getTotalKey(sequenceFlowId);
                Object variable = this.taskService.getVariable(task.getId(), routerCountKey);
                int routerCount = Objects.isNull(variable) ? 0 : Integer.parseInt(variable.toString());
                TyplmLoggerUtil.debug(log, () -> {
                    return "dealVariableStrategyAll  路由数统计routerCount ==> 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(routerCount)};
                });
                if (routerCount > 0) {
                    ++chooseCount;
                }
            }

            if (TyAccountContext.isDebug()) {
                log.info("dealVariableStrategyAll  chooseCount ==> 【{}】", JSONObject.toJSONString(chooseCount));
            }

            if (chooseCount > 1) {
                multiChooseFlag = true;
            }

            if (TyAccountContext.isDebug()) {
                log.info("dealVariableStrategyAll  multiChooseFlag ==> 【{}】", JSONObject.toJSONString(multiChooseFlag));
            }

            this.taskService.setVariable(task.getId(), "multiChooseFlag", multiChooseFlag);
        }

    }

    private void dealVariableStrategyOne(UserTask userTask, Task task, WorkFlowContainerView workFlowContainerView, List<String> routerCheckList, ExecutionStrategyDTO executionStrategy) {
        List<FlowTaskUser> flowTaskUsers = this.typlmFlowTaskUserService.queryListByTaskAndFlowContainer(userTask.getId(), workFlowContainerView.getOid(), workFlowContainerView.getOtype());
        TyplmLoggerUtil.debug(log, () -> {
            return "dealVariableStrategyOne  获取到的执行人集合flowTaskUsers <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskUsers)};
        });
        if (CollUtil.isNotEmpty(flowTaskUsers)) {
            Map<BigInteger, FlowTaskUser> taskUserMap = (Map)flowTaskUsers.stream().collect(Collectors.toMap(FlowTaskUser::getUserOid, (item) -> {
                return item;
            }, (k1, k2) -> {
                return k2;
            }));
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyOne  执行人集合转换的taskUserMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(taskUserMap)};
            });
            long requiredCount = flowTaskUsers.stream().filter((item) -> {
                return REQUIRED_VALUE.equals(item.getRequired());
            }).count();
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyOne  执行人中的必需数量requiredCount ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(requiredCount)};
            });
            boolean completeFlag = false;
            Object obj = this.taskService.getVariable(task.getId(), "requiredCompleteCount");
            int requiredCompleteCount = Integer.parseInt(ObjectUtils.isNotEmpty(obj) ? obj.toString() : "0");
            if (TyAccountContext.isDebug()) {
                log.info("dealVariableStrategyOne  获取到的已完成的必需数量requiredCompleteCount <== 【{}】", JSONObject.toJSONString(requiredCompleteCount));
            }

            FlowTaskUser flowTaskUser = this.getFlowTaskUserFromMap(task, taskUserMap);
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyOne  获取到的flowTaskUser <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowTaskUser)};
            });
            Integer required = Objects.nonNull(flowTaskUser) ? flowTaskUser.getRequired() : 0;
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyOne  获取到的flowTaskUser是否必需required ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(required)};
            });
            if (requiredCount == 0L) {
                completeFlag = this.checkCompleteFlag(task, executionStrategy);
                this.setLastChoice(task, routerCheckList);
            } else {
                if (ObjectUtils.isNotEmpty(flowTaskUser)) {
                    if (REQUIRED_VALUE.equals(required)) {
                        completeFlag = this.checkCompleteFlag(task, executionStrategy);
                        TaskService var10000 = this.taskService;
                        String var10001 = task.getId();
                        ++requiredCompleteCount;
                        var10000.setVariable(var10001, "requiredCompleteCount", requiredCompleteCount);
                        if (TyAccountContext.isDebug()) {
                            log.info("dealVariableStrategyOne  已完成的必需数量requiredCompleteCount ==> 【{}】", JSONObject.toJSONString(requiredCompleteCount));
                        }

                        if ((long)requiredCompleteCount == requiredCount && requiredCount > 0L) {
                            completeFlag = true;
                        }
                    } else {
                        this.resetRouteCheckCount(task, routerCheckList);
                    }
                }

                if ((long)requiredCompleteCount == requiredCount && REQUIRED_VALUE.equals(required)) {
                    this.setLastChoice(task, routerCheckList);
                }
            }

            if (TyAccountContext.isDebug()) {
                log.info("dealVariableStrategyOne  是否完成标识completeFlag ==> 【{}】", JSONObject.toJSONString(completeFlag));
            }

            this.taskService.setVariable(task.getId(), "completeFlag", completeFlag);
        }

    }

    private boolean checkCompleteFlag(Task task, ExecutionStrategyDTO executionStrategy) {
        boolean completeFlag = false;
        String router = executionStrategy.getRouter();
        List<String> routerList = Arrays.asList(router.split(","));
        TyplmLoggerUtil.debug(log, () -> {
            return "checkCompleteFlag  routerList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(routerList)};
        });
        Iterator var6 = routerList.iterator();

        while(var6.hasNext()) {
            String routerStr = (String)var6.next();
            String routerCountKey = CountHandler.getTotalKey(routerStr);
            TyplmLoggerUtil.debug(log, () -> {
                return "checkCompleteFlag  路由变量routerCountKey ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(routerCountKey)};
            });
            Object variable = this.taskService.getVariable(task.getId(), routerCountKey);
            int routerCount = Integer.parseInt(ObjectUtils.isNotEmpty(variable) ? variable.toString() : "0");
            TyplmLoggerUtil.debug(log, () -> {
                return "checkCompleteFlag  路由变量值routerCount ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(routerCount)};
            });
            if (routerCount > 0) {
                completeFlag = true;
                break;
            }
        }

        if (TyAccountContext.isDebug()) {
            log.info("checkCompleteFlag  返回的completeFlag ==> 【{}】", JSONObject.toJSONString(completeFlag));
        }

        return completeFlag;
    }

    private void setLastChoice(Task task, List<String> routerCheckList) {
        Iterator var3 = routerCheckList.iterator();

        while(var3.hasNext()) {
            String router = (String)var3.next();
            this.taskService.setVariable(task.getId(), "lastChoiceFlag", router);
        }

    }

    private void resetRouteCheckCount(Task task, List<String> routerCheckList) {
        Iterator var3 = routerCheckList.iterator();

        while(var3.hasNext()) {
            String routerCheck = (String)var3.next();
            String routerCountKey = CountHandler.getTotalKey(routerCheck);
            TyplmLoggerUtil.debug(log, () -> {
                return "resetRouteCheckCount  变量名称routerCountKey ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(routerCountKey)};
            });
            Object variable = this.taskService.getVariable(task.getId(), routerCountKey);
            int routerCount = Objects.isNull(variable) ? 0 : Integer.parseInt(variable.toString());
            if (TyAccountContext.isDebug()) {
                log.info("resetRouteCheckCount  获取到的变量值routerCount <== 【{}】", JSONObject.toJSONString(routerCount));
            }

            TaskService var10000 = this.taskService;
            String var10001 = task.getId();
            --routerCount;
            var10000.setVariable(var10001, routerCountKey, routerCount);
        }

    }

    private void dealVariableStrategyNone(UserTask userTask, Task task, WorkFlowContainerView workFlowContainerView, List<String> routerCheckList) {
        List<FlowTaskUser> flowTaskUsers = this.typlmFlowTaskUserService.queryListByTaskAndFlowContainer(userTask.getId(), workFlowContainerView.getOid(), workFlowContainerView.getOtype());
        TyplmLoggerUtil.debug(log, () -> {
            return "dealVariableStrategyNone  获取到的执行人集合flowTaskUsers <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskUsers)};
        });
        if (CollUtil.isNotEmpty(flowTaskUsers)) {
            Map<BigInteger, FlowTaskUser> taskUserMap = (Map)flowTaskUsers.stream().collect(Collectors.toMap(FlowTaskUser::getUserOid, (item) -> {
                return item;
            }, (k1, k2) -> {
                return k2;
            }));
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyNone  执行人集合转换的taskUserMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(taskUserMap)};
            });
            long requiredCount = flowTaskUsers.stream().filter((item) -> {
                return REQUIRED_VALUE.equals(item.getRequired());
            }).count();
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyNone  执行人中的必需数量requiredCount ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(requiredCount)};
            });
            boolean requiredFlag = false;
            Object obj = this.taskService.getVariable(task.getId(), "requiredCompleteCount");
            int requiredCompleteCount = Integer.parseInt(ObjectUtils.isNotEmpty(obj) ? obj.toString() : "0");
            if (TyAccountContext.isDebug()) {
                log.info("dealVariableStrategyNone  获取到的已完成的必需数量requiredCompleteCount <== 【{}】", JSONObject.toJSONString(requiredCompleteCount));
            }

            FlowTaskUser flowTaskUser = this.getFlowTaskUserFromMap(task, taskUserMap);
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyNone  获取到的flowTaskUser <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowTaskUser)};
            });
            Integer required = Objects.nonNull(flowTaskUser) ? flowTaskUser.getRequired() : 0;
            TyplmLoggerUtil.debug(log, () -> {
                return "dealVariableStrategyNone  获取到的flowTaskUser是否必需required ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(required)};
            });
            if (requiredCount == 0L) {
                requiredFlag = true;
            } else {
                if (REQUIRED_VALUE.equals(required)) {
                    TaskService var10000 = this.taskService;
                    String var10001 = task.getId();
                    ++requiredCompleteCount;
                    var10000.setVariable(var10001, "requiredCompleteCount", requiredCompleteCount);
                }

                if (TyAccountContext.isDebug()) {
                    log.info("dealVariableStrategyOne  已完成的必需数量requiredCompleteCount ==> 【{}】", JSONObject.toJSONString(requiredCompleteCount));
                }

                if ((long)requiredCompleteCount == requiredCount && REQUIRED_VALUE.equals(required)) {
                    requiredFlag = true;
                }
            }

            if (TyAccountContext.isDebug()) {
                log.info("dealVariableStrategyOne  更新变量值requiredFlag ==> 【{}】", JSONObject.toJSONString(requiredFlag));
            }

            this.taskService.setVariable(task.getId(), "requiredFlag", requiredFlag);
            List<SequenceFlow> outgoingFlows = userTask.getOutgoingFlows();
            if (CollUtil.isNotEmpty(outgoingFlows)) {
                Iterator var15 = outgoingFlows.iterator();

                while(var15.hasNext()) {
                    SequenceFlow sequenceFlow = (SequenceFlow)var15.next();
                    String sequenceFlowId = sequenceFlow.getId();
                    TyplmLoggerUtil.debug(log, () -> {
                        return "dealVariableStrategyOne  路由sequenceFlowId ==> 【{}】";
                    }, () -> {
                        return new Object[]{sequenceFlowId};
                    });
                    if (!routerCheckList.contains(sequenceFlowId)) {
                        String routerCountKey = CountHandler.getTotalKey(sequenceFlowId);
                        this.taskService.setVariable(task.getId(), routerCountKey, 0);
                    }
                }
            }
        }

    }

    private FlowTaskUser getFlowTaskUserFromMap(Task task, Map<BigInteger, FlowTaskUser> taskUserMap) {
        FlowTaskUser flowTaskUser = null;
        if (Objects.nonNull(task.getOwner())) {
            flowTaskUser = (FlowTaskUser)taskUserMap.get(new BigInteger(task.getOwner()));
        }

        if (Objects.isNull(flowTaskUser)) {
            flowTaskUser = (FlowTaskUser)taskUserMap.get(TyplmWorkFlowUtil.getUserOid());
        }

        if (Objects.isNull(flowTaskUser)) {
            flowTaskUser = (FlowTaskUser)taskUserMap.get(task.getAssignee());
        }

        if (TyAccountContext.isDebug()) {
            log.info("getFlowTaskUserFromMap 返回的flowTaskUser ==> 【{}】", JSONObject.toJSONString(flowTaskUser));
        }

        return flowTaskUser;
    }

    protected FlowTaskRecord beforeProcessFinished(Task task, String operateName, String operateTarget, WorkFlowContainer workFlowContainer, ApprovalOpinionDTO approvalOpinionDTO) {
        if (StringUtils.length(approvalOpinionDTO.getRemark()) > REMARK_MAX_LENGTH) {
            throw WorkFlowErrorCodeEnum.REMARK_LENGTH_MORE_THAN_MAX.getException(new Object[]{REMARK_MAX_LENGTH});
        } else {
            TyplmFlowTaskRecordService flowTaskRecordService = (TyplmFlowTaskRecordService)SpringUtil.getBean(TyplmFlowTaskRecordService.class);
            FlowTaskRecordLink link = this.typlmFlowTaskRecordLinkService.createRecordLinkByInstanceId(task.getProcessInstanceId());
            TyplmLoggerUtil.debug(log, () -> {
                return "beforeProcessFinished 创建的link ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(link)};
            });
            CreateTaskRecordDTO createTaskRecordDTO = new CreateTaskRecordDTO((BigInteger)null, operateName, operateTarget, approvalOpinionDTO.getRemark(), approvalOpinionDTO.getApprovalOpinion(), task.getId(), task.getTaskDefinitionKey(), task.getName());
            FlowTaskRecord flowTaskRecord = flowTaskRecordService.createFlowTaskRecordByLink(link, createTaskRecordDTO);
            TyplmLoggerUtil.debug(log, () -> {
                return "beforeProcessFinished 创建的flowTaskRecord ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowTaskRecord)};
            });
            Process process = this.repositoryService.getBpmnModel(task.getProcessDefinitionId()).getMainProcess();
            UserTask userTask = (UserTask)TyplmWorkFlowUtil.getFlowElementById(process, task.getTaskDefinitionKey());
            TyplmLoggerUtil.debug(log, () -> {
                return "beforeProcessFinished 获取到的userTask <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userTask)};
            });
            TyplmWorkFlowSignService typlmWorkFlowSignService = (TyplmWorkFlowSignService)SpringUtil.getBean(TyplmWorkFlowSignService.class);
            WorkFlowSignElement workFlowSignElement = (WorkFlowSignElement)BeanUtil.copyProperties(flowTaskRecord, WorkFlowSignElement.class, new String[0]);
            workFlowSignElement.setCreateDate(flowTaskRecord.getCreateTime());
            workFlowSignElement.setUpdateDate(flowTaskRecord.getUpdateTime());
            workFlowSignElement.setSignKey(typlmWorkFlowSignService.getSignKey(userTask));
            TyplmLoggerUtil.debug(log, () -> {
                return "beforeProcessFinished 组装的workFlowSignElement ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(workFlowSignElement)};
            });
            typlmWorkFlowSignService.addWorkFlowSign(workFlowSignElement, workFlowContainer, task);
            return flowTaskRecord;
        }
    }

    public void sendMessage(FlowTaskInfo flowTaskInfo, BigInteger userId, String workFlowContainerOid, String status) {
        TyplmLoggerUtil.debug(log, () -> {
            return "sendMessage 方法入参flowTaskInfo ==> 【{}】; userId ==> 【{}】; workFlowContainerOid ==> 【{}】; status ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo), JSONObject.toJSONString(userId), workFlowContainerOid, status};
        });
        String content = "[" + flowTaskInfo.getWorkFlowContainerName() + "]" + flowTaskInfo.getTaskName() + status;
        String title = flowTaskInfo.getWorkFlowContainerName() + "(" + flowTaskInfo.getTaskName() + ")";
        Set<BigInteger> userIdList = new HashSet();
        userIdList.add(flowTaskInfo.getWorkFlowContainerView().getCreatorOid());
        userIdList.add(userId);
        this.typlmFlowMessageExtendService.sendMessage(title, content, userId, flowTaskInfo.getEmergencyDegree(), workFlowContainerOid);
    }

    private Map<String, UserTaskDTO> getTaskUserMap(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getTaskUserMap 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
        List<UserTaskDTO> userTaskList = workFlowContainerView.getUserTaskList();
        Map<String, UserTaskDTO> taskUserMap = new HashMap();
        Iterator var5 = userTaskList.iterator();

        while(true) {
            List children;
            do {
                if (!var5.hasNext()) {
                    TyplmLoggerUtil.debug(log, () -> {
                        return "getTaskUserMap 返回的taskUserMap ==> 【{}】";
                    }, () -> {
                        return new Object[]{JSONObject.toJSONString(taskUserMap)};
                    });
                    return taskUserMap;
                }

                UserTaskDTO userTaskDTO = (UserTaskDTO)var5.next();
                taskUserMap.put(userTaskDTO.getId(), userTaskDTO);
                children = userTaskDTO.getChildren();
            } while(CollectionUtils.isEmpty(children));

            Iterator var8 = children.iterator();

            while(var8.hasNext()) {
                UserTaskDTO child = (UserTaskDTO)var8.next();
                taskUserMap.put(child.getId(), child);
            }
        }
    }

    public void deliverTask(DeliverTaskView deliverTaskView) {
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverTask 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(deliverTaskView)};
        });
        String taskId = deliverTaskView.getTaskId();
        this.getNonTask(taskId);
        this.flowProcessExtendService.deliverTaskPreProcess(deliverTaskView);
        Task task = (Task)((TaskQuery)this.taskService.createTaskQuery().taskId(taskId)).singleResult();
        String oriAssignee = task.getAssignee();
        this.taskService.setOwner(taskId, TyplmWorkFlowUtil.getUser().getOid().toString());
        BigInteger userId = deliverTaskView.getUserId();
        ArgumentUtils.checkArgumentBlank(userId, "转交人");
        this.taskService.setAssignee(taskId, userId.toString());
        String processInstanceId = task.getProcessInstanceId();
        FlowTaskRecordLink link = this.typlmFlowTaskRecordLinkService.createRecordLinkByInstanceId(processInstanceId);
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverTask 查询到的link <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(link)};
        });
        CreateTaskRecordDTO createTaskRecordDTO = new CreateTaskRecordDTO((BigInteger)null, "转交", (String)null, deliverTaskView.getRemark(), (String)null, task.getId(), task.getTaskDefinitionKey(), task.getName());
        this.typlmFlowTaskRecordService.createFlowTaskRecordByLink(link, createTaskRecordDTO);
        FlowTaskInfo taskDetailView = this.getTaskDetailView(taskId);
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverTask 查询到的taskDetailView <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(taskDetailView)};
        });
        Map<String, Object> params = new HashMap();
        params.put("taskId", task.getTaskDefinitionKey());
        params.put("userOid", new BigInteger(oriAssignee));
        ProcessInstance processInstance = (ProcessInstance)this.runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverTask 查询到的流程实例processInstance <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(processInstance)};
        });
        String workFlowContainerId = processInstance.getBusinessKey();
        if (StringUtils.isBlank(workFlowContainerId)) {
            workFlowContainerId = this.runtimeService.getVariable(processInstanceId, "workFlowContainerId").toString();
        }

        params.put("workFlowContainerOid", new BigInteger(workFlowContainerId));
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverTask 组装的参数params <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(params)};
        });
        List<FlowTaskUser> flowTaskUsers = this.typlmFlowTaskUserService.simpleQueryListByParams(params);
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverTask 查询到的流程执行人flowTaskUsers <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskUsers)};
        });
        Iterator var14 = flowTaskUsers.iterator();

        while(var14.hasNext()) {
            FlowTaskUser flowTaskUser = (FlowTaskUser)var14.next();
            flowTaskUser.setUserOid(userId);
            this.typlmFlowTaskUserService.update(flowTaskUser);
        }

        taskDetailView.setProcessDefId(processInstance.getProcessDefinitionId());
        this.deliverDynamic(taskId, taskDetailView, oriAssignee, userId);
        this.sendMessage(taskDetailView, userId, taskDetailView.getWorkFlowContainerOid().toString(), "待办");
    }

    private void deliverDynamic(String taskId, FlowTaskInfo taskDetailView, String oriAssignee, BigInteger userId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverDynamic 方法入参taskId ==> 【{}】; taskDetailView ==> 【{}】; oriAssignee ==> 【{}】; userId ==> 【{}】";
        }, () -> {
            return new Object[]{taskId, JSONObject.toJSONString(taskDetailView), oriAssignee, JSONObject.toJSONString(userId)};
        });
        List<AccessObjRightDO> accessObjRightList = this.typlmWorkFlowAccessExtendService.queryObjAccess(new BigInteger(oriAssignee), "ty.inteplm.org.CTyUser", taskId);
        TyplmLoggerUtil.debug(log, () -> {
            return "deliverDynamic 查询到的权限accessObjRightList <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(accessObjRightList)};
        });
        if (!ObjectUtils.isEmpty(accessObjRightList)) {
            List<AccessObjRightDO> updateAccessObjectRightList = (List)accessObjRightList.stream().map((item) -> {
                item.setPrincipalrefoid(userId);
                return item;
            }).collect(Collectors.toList());
            TyplmLoggerUtil.debug(log, () -> {
                return "deliverDynamic 更新的权限updateAccessObjectRightList ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(updateAccessObjectRightList)};
            });
            this.typlmWorkFlowAccessExtendService.batchUpdateObjAccess(updateAccessObjectRightList);
            WorkFlowContainerView workFlowContainerView = taskDetailView.getWorkFlowContainerView();
            if (!Objects.isNull(workFlowContainerView)) {
                String taskDefKey = taskDetailView.getTaskDefKey();
                String processDefId = taskDetailView.getProcessDefId();
                UserTask userTask = this.typlmFlowElementService.getUserTask(processDefId, taskDefKey);
                TyplmLoggerUtil.debug(log, () -> {
                    return "deliverDynamic 获取到的userTask <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(userTask)};
                });
                boolean needDistributeObjects = this.typlmFlowElementService.checkContainerViewNeedDistributeObjects(userTask);
                TyplmLoggerUtil.debug(log, () -> {
                    return "deliverDynamic 是否需要分配内容needDistributeObjects <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(needDistributeObjects)};
                });
                TyplmWorkFlowContainerService flowContainerService = (TyplmWorkFlowContainerService)TySpringBeanUtil.getBean(TyplmWorkFlowContainerService.class);
                Map<IdentifierEntity, List<IdentifierEntity>> flowObjectMap = flowContainerService.getFlowObjectMap(workFlowContainerView, taskDefKey, needDistributeObjects);
                TyplmLoggerUtil.debug(log, () -> {
                    return "deliverDynamic 获取到的流程对象flowObjectMap <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(flowObjectMap)};
                });
                if (!ObjectUtils.isEmpty(flowObjectMap)) {
                    List<IdentifierEntity> clearEntityList = new ArrayList();
                    Set<IdentifierEntity> mainObjIdentifier = flowObjectMap.keySet();
                    if (ObjectUtils.isNotEmpty(mainObjIdentifier)) {
                        clearEntityList.addAll(mainObjIdentifier);
                    }

                    List<IdentifierEntity> relativeObjIdentifierList = (List)flowObjectMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
                    if (ObjectUtils.isNotEmpty(relativeObjIdentifierList)) {
                        clearEntityList.addAll(relativeObjIdentifierList);
                    }

                    TyplmLoggerUtil.debug(log, () -> {
                        return "deliverDynamic 需要清除权限的对象clearEntityList ==> 【{}】";
                    }, () -> {
                        return new Object[]{JSONObject.toJSONString(clearEntityList)};
                    });
                    if (!ObjectUtils.isEmpty(clearEntityList)) {
                        this.typlmWorkFlowAccessExtendService.cleanAdHoc(clearEntityList);
                    }
                }
            }
        }
    }

    public InputStream getFlowChart(WorkFlowContainer workFlowContainer) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getFlowChart 方法入参workFlowContainer ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainer)};
        });
        String flowableProcessId = workFlowContainer.getFlowableProcessId();
        if (StringUtils.isBlank(flowableProcessId)) {
            throw SystemErrorCodeEnum.PROCESS_NOT_EXIST.getException(new Object[0]);
        } else {
            HistoricProcessInstance historicProcessInstance = (HistoricProcessInstance)this.historyService.createHistoricProcessInstanceQuery().processInstanceId(flowableProcessId).singleResult();
            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowChart 通过流程实例ID获取历史流程实例historicProcessInstance <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(historicProcessInstance)};
            });
            List<HistoricActivityInstance> historicActivityInstanceList = ((HistoricActivityInstanceQuery)this.historyService.createHistoricActivityInstanceQuery().processInstanceId(flowableProcessId).orderByHistoricActivityInstanceStartTime().asc()).list();
            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowChart 通过流程实例ID获取流程中已经执行的节点historicActivityInstanceList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(historicActivityInstanceList)};
            });
            List<String> highLightedActiveIdList = new ArrayList();
            Iterator var6 = historicActivityInstanceList.iterator();

            while(var6.hasNext()) {
                HistoricActivityInstance historicActivityInstance = (HistoricActivityInstance)var6.next();
                highLightedActiveIdList.add(historicActivityInstance.getActivityId());
                TyplmLoggerUtil.debug(log, () -> {
                    return "getFlowChart 已执行的节点[{}-{}-{}-{}]";
                }, () -> {
                    return new Object[]{historicActivityInstance.getId(), historicActivityInstance.getActivityId(), historicActivityInstance.getActivityName(), historicActivityInstance.getAssignee()};
                });
            }

            List<Execution> runningActivityInstanceList = this.runtimeService.createExecutionQuery().processInstanceId(flowableProcessId).list();
            List<String> runningActivityIdList = new ArrayList();
            Iterator var8 = runningActivityInstanceList.iterator();

            while(var8.hasNext()) {
                Execution execution = (Execution)var8.next();
                if (StringUtils.isNotEmpty(execution.getActivityId())) {
                    runningActivityIdList.add(execution.getActivityId());
                    TyplmLoggerUtil.debug(log, () -> {
                        return "getFlowChart 执行中的节点[{}-{}-{}]";
                    }, () -> {
                        return new Object[]{execution.getId(), execution.getActivityId(), execution.getName()};
                    });
                }
            }

            CustomProcessDiagramGenerator processDiagramGenerator = new CustomProcessDiagramGenerator();
            BpmnModel bpmnModel = this.repositoryService.getBpmnModel(historicProcessInstance.getProcessDefinitionId());
            TyplmLoggerUtil.debug(log, () -> {
                return "getFlowChart 获取流程定义Model <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(bpmnModel)};
            });
            List<String> highLightedFlowIds = this.getHighLightedFlows(bpmnModel, historicActivityInstanceList);
            return processDiagramGenerator.generateDiagramCustom(bpmnModel, "png", highLightedActiveIdList, runningActivityIdList, highLightedFlowIds, "宋体", "微软雅黑", (ClassLoader)null, 2.0);
        }
    }

    private List<String> getHighLightedFlows(BpmnModel bpmnModel, List<HistoricActivityInstance> historicActivityInstanceList) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getHighLightedFlows 方法入参bpmnModel ==> 【{}】; historicActivityInstanceList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(bpmnModel), JSONObject.toJSONString(historicActivityInstanceList)};
        });
        List<String> highLightedFlowIdList = new ArrayList();
        List<FlowNode> allHistoricActivityNodeList = new ArrayList();
        List<HistoricActivityInstance> finishedActivityInstanceList = new ArrayList();
        Iterator var6 = historicActivityInstanceList.iterator();

        while(var6.hasNext()) {
            HistoricActivityInstance historicActivityInstance = (HistoricActivityInstance)var6.next();
            FlowNode flowNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(historicActivityInstance.getActivityId(), true);
            allHistoricActivityNodeList.add(flowNode);
            if (historicActivityInstance.getEndTime() != null) {
                finishedActivityInstanceList.add(historicActivityInstance);
            }
        }

        for(int k = 0; k < finishedActivityInstanceList.size(); ++k) {
            HistoricActivityInstance currentActivityInstance = (HistoricActivityInstance)finishedActivityInstanceList.get(k);
            FlowNode currentFlowNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(currentActivityInstance.getActivityId(), true);
            List<SequenceFlow> outgoingFlowList = currentFlowNode.getOutgoingFlows();
            if (!"parallelGateway".equals(currentActivityInstance.getActivityType()) && !"inclusiveGateway".equals(currentActivityInstance.getActivityType())) {
                String currentActivityId = currentActivityInstance.getActivityId();
                int size = historicActivityInstanceList.size();
                boolean ifStartFind = false;
                boolean ifFind = false;
                TyplmLoggerUtil.debug(log, () -> {
                    return "getHighLightedFlows【开始】-匹配当前节点-ActivityId=【{}】需要高亮显示的流出线";
                }, () -> {
                    return new Object[]{currentActivityId};
                });
                TyplmLoggerUtil.debug(log, () -> {
                    return "getHighLightedFlows 循环历史节点";
                });

                for(int i = 0; i < historicActivityInstanceList.size(); ++i) {
                    HistoricActivityInstance historicActivityInstance = (HistoricActivityInstance)historicActivityInstanceList.get(i);
                    if (TyAccountContext.isDebug()) {
                        log.info("getHighLightedFlows 第【{}/{}】个历史节点-ActivityId=[{}]", new Object[]{i + 1, size, historicActivityInstance.getActivityId()});
                    }

                    if (i >= k && historicActivityInstance.getActivityId().equals(currentActivityId)) {
                        if (TyAccountContext.isDebug()) {
                            log.info("getHighLightedFlows 第[{}]个历史节点和当前节点一致-ActivityId=[{}]", i + 1, historicActivityInstance.getActivityId());
                        }

                        ifStartFind = true;
                    } else {
                        if (ifStartFind) {
                            TyplmLoggerUtil.debug(log, () -> {
                                return "getHighLightedFlows [开始]-循环当前节点-ActivityId=【{}】的所有流出线";
                            }, () -> {
                                return new Object[]{currentActivityId};
                            });
                            Iterator var17 = outgoingFlowList.iterator();

                            while(var17.hasNext()) {
                                SequenceFlow sequenceFlow = (SequenceFlow)var17.next();
                                TyplmLoggerUtil.debug(log, () -> {
                                    return "getHighLightedFlows 当前流出线的下级节点=[{}]";
                                }, () -> {
                                    return new Object[]{sequenceFlow.getTargetRef()};
                                });
                                if (historicActivityInstance.getActivityId().equals(sequenceFlow.getTargetRef())) {
                                    TyplmLoggerUtil.debug(log, () -> {
                                        return "getHighLightedFlows 当前节点[{}]需高亮显示的流出线=[{}]";
                                    }, () -> {
                                        return new Object[]{currentActivityId, sequenceFlow.getId()};
                                    });
                                    highLightedFlowIdList.add(sequenceFlow.getId());
                                    ifFind = true;
                                    break;
                                }
                            }

                            TyplmLoggerUtil.debug(log, () -> {
                                return "getHighLightedFlows [完成]-循环当前节点-ActivityId=【{}】的所有流出线";
                            }, () -> {
                                return new Object[]{currentActivityId};
                            });
                        }

                        if (ifFind) {
                            break;
                        }
                    }
                }

                TyplmLoggerUtil.debug(log, () -> {
                    return "getHighLightedFlows 【完成】-匹配当前节点-ActivityId=【{}】需要高亮显示的流出线";
                }, () -> {
                    return new Object[]{currentActivityId};
                });
            } else {
                Iterator var11 = outgoingFlowList.iterator();

                while(var11.hasNext()) {
                    SequenceFlow outgoingFlow = (SequenceFlow)var11.next();
                    FlowNode targetFlowNode = (FlowNode)bpmnModel.getMainProcess().getFlowElement(outgoingFlow.getTargetRef(), true);
                    if (allHistoricActivityNodeList.contains(targetFlowNode)) {
                        highLightedFlowIdList.add(outgoingFlow.getId());
                    }
                }
            }
        }

        return highLightedFlowIdList;
    }

    @Transactional
    public void terminalProcess(FlowTerminalVO flowTerminalVO) {
        BigInteger workFlowContainerId = flowTerminalVO.getWorkFlowContainerId();
        String message = flowTerminalVO.getMessage();
        TyplmLoggerUtil.debug(log, () -> {
            return "terminalProcess 方法入参workFlowContainerId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerId)};
        });
        WorkFlowContainer workFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowContainerId);
        if (TyAccountContext.isDebug()) {
            log.info("terminalProcess 查询出的workFlowContainer <== 【{}】", JSONObject.toJSONString(workFlowContainer));
        }

        if (workFlowContainer == null) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[]{workFlowContainerId});
        } else {
            workFlowContainer = this.findRootWorkFlowContainer(workFlowContainer);
            if (TyAccountContext.isDebug()) {
                log.info("terminalProcess 查询出的根流程容器workFlowContainer <== 【{}】", JSONObject.toJSONString(workFlowContainer));
            }

            this.checkMessage(message);
            if (ObjectUtils.notEqual(workFlowContainer.getStatus(), WorkFlowContainerStatusEnum.PROCESSING.getValue())) {
                throw WorkFlowErrorCodeEnum.WORK_FLOW_IS_NOT_PROCESSING.getException(new Object[]{workFlowContainerId});
            } else {
                boolean flag = this.readPreferenceValue(workFlowContainer);
                this.handleSubWorkFlowContainer(workFlowContainer, message, flag);
                Process process = this.obtainMainProcessByDeploymentId(workFlowContainer.getDeploymentId());
                String flowableProcessId = workFlowContainer.getFlowableProcessId();
                DelegateExecution delegateExecution = (DelegateExecution)this.runtimeService.createExecutionQuery().executionId(flowableProcessId).singleResult();
                ManagementService managementService = (ManagementService)TySpringBeanUtil.getBean(ManagementService.class);
                this.invokeListener(process, "beforeTermination", managementService, delegateExecution);
                log.info("excute excutionListener before terminalprocess");
                List<Task> list = ((TaskQuery)this.taskService.createTaskQuery().processInstanceId(workFlowContainer.getFlowableProcessId())).list();
                this.terminalProcess(workFlowContainer, message, flag);
                this.taskService.deleteTasks((Collection)list.stream().map(TaskInfo::getId).collect(Collectors.toSet()));
                log.info("delete userTask in terminalprocess");
                this.invokeListener(process, "afterTermination", managementService, delegateExecution);
                log.info("excute excutionListener after terminalprocess");
            }
        }
    }

    @Transactional
    public void terminalProcess(BigInteger workFlowContainerId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "terminalProcess 方法入参workFlowContainerId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerId)};
        });
        WorkFlowContainer workFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowContainerId);
        if (TyAccountContext.isDebug()) {
            log.info("terminalProcess 查询出的workFlowContainer <== 【{}】", JSONObject.toJSONString(workFlowContainer));
        }

        if (workFlowContainer == null) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[]{workFlowContainerId});
        } else {
            workFlowContainer = this.findRootWorkFlowContainer(workFlowContainer);
            if (TyAccountContext.isDebug()) {
                log.info("terminalProcess 查询出的根流程容器workFlowContainer <== 【{}】", JSONObject.toJSONString(workFlowContainer));
            }

            this.handleSubWorkFlowContainer(workFlowContainer, "", false);
            Process process = this.obtainMainProcessByDeploymentId(workFlowContainer.getDeploymentId());
            String flowableProcessId = workFlowContainer.getFlowableProcessId();
            DelegateExecution delegateExecution = (DelegateExecution)this.runtimeService.createExecutionQuery().executionId(flowableProcessId).singleResult();
            ManagementService managementService = (ManagementService)TySpringBeanUtil.getBean(ManagementService.class);
            this.invokeListener(process, "beforeTermination", managementService, delegateExecution);
            log.info("excute excutionListener before terminalprocess");
            List<Task> list = ((TaskQuery)this.taskService.createTaskQuery().processInstanceId(workFlowContainer.getFlowableProcessId())).list();
            this.terminalProcess(workFlowContainer, "", false);
            this.taskService.deleteTasks((Collection)list.stream().map(TaskInfo::getId).collect(Collectors.toSet()));
            log.info("delete userTask in terminalprocess");
            this.invokeListener(process, "afterTermination", managementService, delegateExecution);
            log.info("excute excutionListener after terminalprocess");
        }
    }

    private void checkMessage(String message) {
        if (StringUtils.isEmpty(message)) {
            throw WorkFlowErrorCodeEnum.TERMINAL_MESSAGE_IS_EMPTY.getException(new Object[0]);
        } else if (message.length() > 1000) {
            throw WorkFlowErrorCodeEnum.TERMINAL_MESSAGE_IS_TOO_LONG.getException(new Object[0]);
        }
    }

    private boolean readPreferenceValue(WorkFlowContainer workFlowContainer) {
        if (workFlowContainer == null) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[0]);
        } else {
            boolean enable = false;
            List<String> selectPreferenceValueList = Collections.singletonList("Create_Terminate_Workflow");
            Map<String, Object> preferenceCollectRulesMap = this.typlmPreferenceValueUtil.readPreferenceValueByKeywords(selectPreferenceValueList);
            Object value = preferenceCollectRulesMap.get("Create_Terminate_Workflow");
            if (ObjectUtils.isNotEmpty(value) && value instanceof Boolean) {
                enable = (Boolean)value;
            }

            return this.checkUser(workFlowContainer, enable);
        }
    }

    private boolean checkUser(WorkFlowContainer workFlowContainer, Boolean enable) {
        if (workFlowContainer == null) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[0]);
        } else {
            if (Objects.isNull(enable)) {
                enable = false;
            }

            BigInteger creatorOid = workFlowContainer.getCreatorOid();
            UserDO user = TyplmWorkFlowUtil.getUser();
            List<BigInteger> managerOidList = new ArrayList();
            Example example = new Example(FlowContainerUsageLink.class, true, true);
            Example.Criteria criteria = example.createCriteria();
            criteria.andEqualTo("flowContainerOid", workFlowContainer.getOid());
            criteria.andEqualTo("refObjectOtype", user.getOtype());
            criteria.andEqualTo("usage", "manager");
            List<FlowContainerUsageLink> flowContainerUsageLinks = this.typlmFlowContainerUsageLinkMapper.selectByExample(example);
            if (!CollectionUtils.isEmpty(flowContainerUsageLinks)) {
                managerOidList = (List)flowContainerUsageLinks.stream().map(FlowContainerUsageLink::getRefObjectOid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList());
            }

            GroupDO adminGroup = this.typlmGroupService.queryOutGroupByNameForEnabled("Administrators");
            List<UserDO> usersByGroup = this.typlmUserService.getUsersByGroup(adminGroup);
            List<BigInteger> adminOids = (List)usersByGroup.stream().map(CTyEntityBaseDO::getOid).collect(Collectors.toList());
            if (enable && creatorOid.compareTo(user.getOid()) == 0) {
                return true;
            } else if (!((List)managerOidList).contains(user.getOid()) && !adminOids.contains(user.getOid())) {
                throw WorkFlowErrorCodeEnum.USER_CAN_NOT_TERMINAL.getException(new Object[]{user.getName()});
            } else {
                return false;
            }
        }
    }

    private void invokeListener(Process process, String event, ManagementService managementService, DelegateExecution delegateExecution) {
        List<FlowableListener> flowableListeners = (List)process.getExecutionListeners().stream().filter((listener) -> {
            return StringUtils.equals(event, listener.getEvent());
        }).collect(Collectors.toList());
        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(flowableListeners)) {
            managementService.executeCommand(new ExecuteListenCmd(delegateExecution, flowableListeners, process, event));
        }

    }

    private Process obtainMainProcessByDeploymentId(String deploymentId) {
        ProcessDefinition processDefinition = (ProcessDefinition)this.repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
        BpmnModel bpmnModel = this.repositoryService.getBpmnModel(processDefinition.getId());
        return bpmnModel.getMainProcess();
    }

    public void terminalProcess(WorkFlowContainer workFlowContainer, String message, boolean flag) {
        TyplmLoggerUtil.debug(log, () -> {
            return "terminalProcess 方法入参workFlowContainerId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainer)};
        });
        if (workFlowContainer != null) {
            Integer status = workFlowContainer.getStatus();
            if (status != null && !status.equals(0)) {
                if (status.compareTo(1) > 0) {
                    throw WorkFlowErrorCodeEnum.WORK_FLOW_TERMINATED_OR_COMPLETED.getException(new Object[0]);
                } else {
                    String flowableProcessId = workFlowContainer.getFlowableProcessId();
                    String deploymentId = workFlowContainer.getDeploymentId();
                    if (StringUtils.isBlank(flowableProcessId)) {
                        throw WorkFlowErrorCodeEnum.FLOW_PROCESS_ID_IS_EMPTY.getException(new Object[0]);
                    } else if (StringUtils.isBlank(deploymentId)) {
                        throw WorkFlowErrorCodeEnum.DEPLOYMENT_ID_IS_EMPTY.getException(new Object[0]);
                    } else {
                        try {
                            this.terminalProcess(workFlowContainer, flowableProcessId, deploymentId);
                            this.creatFlowTaskRecord(workFlowContainer, message, flag);
                        } catch (Exception var9) {
                            ProcessInstance processInstance = (ProcessInstance)this.runtimeService.createProcessInstanceQuery().processInstanceId(flowableProcessId).singleResult();
                            if (processInstance != null && processInstance.isSuspended()) {
                                this.runtimeService.activateProcessInstanceById(flowableProcessId);
                            }
                        }

                    }
                }
            } else {
                throw WorkFlowErrorCodeEnum.WORK_FLOW_NOT_START.getException(new Object[0]);
            }
        }
    }

    private void terminalProcess(WorkFlowContainer workFlowContainer, String processInstanceId, String deploymentId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "terminalProcess 方法入参workFlowContainerId ==> 【{}】; processInstanceId ==> 【{}】; deploymentId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainer), processInstanceId, deploymentId};
        });
        ProcessInstance processInstance = (ProcessInstance)this.runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
        if (processInstance == null) {
            throw WorkFlowErrorCodeEnum.PROCESS_INSTANCE_NOT_EXIST.getException(new Object[0]);
        } else {
            if (!processInstance.isSuspended()) {
                this.runtimeService.suspendProcessInstanceById(processInstanceId);
            }

            this.runtimeService.deleteProcessInstance(processInstanceId, "管理员终止");
            workFlowContainer.setStatus(WorkFlowContainerStatusEnum.TERMINATION.getValue());
            workFlowContainer.setCompleteStamp(new Date());
            this.typlmWorkFlowContainerService.update(workFlowContainer);
            this.typlmFlowContainerObjectService.handleTerminationFlowContainerObject(workFlowContainer);
        }
    }

    private WorkFlowContainer findRootWorkFlowContainer(WorkFlowContainer workFlowContainer) {
        if (TyAccountContext.isDebug()) {
            log.info("findRootWorkFlowContainer 方法入参workFlowContainerId ==> 【{}】", JSONObject.toJSONString(workFlowContainer));
        }

        String rootFlowableProcessId = workFlowContainer.getRootFlowableProcessId();
        TyplmLoggerUtil.debug(log, () -> {
            return "findRootWorkFlowContainer 父流程容器的id rootFlowableProcessId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(rootFlowableProcessId)};
        });
        if (StringUtils.isNotBlank(rootFlowableProcessId)) {
            workFlowContainer = this.typlmWorkFlowContainerService.getWorkFlowContainerByFlowableProcessId(rootFlowableProcessId);
            workFlowContainer = this.findRootWorkFlowContainer(workFlowContainer);
        }

        return workFlowContainer;
    }

    private void handleSubWorkFlowContainer(WorkFlowContainer workFlowContainer, String message, boolean flag) {
        TyplmLoggerUtil.debug(log, () -> {
            return "handleSubWorkFlowContainer 方法入参workFlowContainerId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainer)};
        });
        Map<String, Object> containerMap = new HashMap();
        containerMap.put("rootFlowableProcessId", workFlowContainer.getFlowableProcessId());
        List<WorkFlowContainer> workFlowContainerList = this.typlmWorkFlowContainerService.simpleQueryListByParams(containerMap);
        TyplmLoggerUtil.debug(log, () -> {
            return "handleSubWorkFlowContainer 查询出的workFlowContainerList <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainerList)};
        });
        if (!CollUtil.isEmpty(workFlowContainerList)) {
            Iterator var6 = workFlowContainerList.iterator();

            while(var6.hasNext()) {
                WorkFlowContainer subWorkFlowContainer = (WorkFlowContainer)var6.next();
                this.handleSubWorkFlowContainer(subWorkFlowContainer, message, flag);
                subWorkFlowContainer.setStatus(WorkFlowContainerStatusEnum.TERMINATION.getValue());
                subWorkFlowContainer.setCompleteStamp(new Date());
                this.typlmWorkFlowContainerService.update(subWorkFlowContainer);
                this.typlmFlowContainerObjectService.handleTerminationFlowContainerObject(subWorkFlowContainer);
                this.creatFlowTaskRecord(subWorkFlowContainer, message, flag);
            }

        }
    }

    private void creatFlowTaskRecord(WorkFlowContainer workFlowContainer, String message, boolean enable) {
        TyplmLoggerUtil.debug(log, () -> {
            return "creatFlowTaskRecord 方法入参workFlowContainerId ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(workFlowContainer)};
        });
        FlowTaskRecord flowTaskRecord = new FlowTaskRecord();
        if (enable) {
            flowTaskRecord.setOperateName("创建者终止");
            flowTaskRecord.setRemark("创建者终止");
        } else {
            flowTaskRecord.setOperateName("管理员终止");
            flowTaskRecord.setRemark("管理员终止");
        }

        if (StringUtils.isNotBlank(message)) {
            message = "终止原因：" + message;
            flowTaskRecord.setApprovalOpinion(message.getBytes(StandardCharsets.UTF_8));
        }

        UserDO currentUser = TyplmWorkFlowUtil.getUser();
        flowTaskRecord.setOperatorOid(currentUser.getOid());
        flowTaskRecord.setOperatorName(currentUser.getFullname());
        flowTaskRecord.setOperatorOtype("com.ty.entity.user.PdmUser");
        flowTaskRecord.setCreatorOid(currentUser.getOid());
        flowTaskRecord.setCreatorName(currentUser.getFullname());
        flowTaskRecord.setCreatorOtype("com.ty.entity.user.PdmUser");
        flowTaskRecord.setUpdaterOid(currentUser.getOid());
        flowTaskRecord.setUpdaterOtype("com.ty.entity.user.PdmUser");
        this.typlmFlowTaskRecordService.createFlowTaskRecord(flowTaskRecord);
        FlowTaskRecordLink link = new FlowTaskRecordLink();
        link.setRecordOid(flowTaskRecord.getOid());
        link.setRecordOtype(flowTaskRecord.getOtype());
        link.setMasterObjectOid(workFlowContainer.getOid());
        link.setMasterObjectOtype(workFlowContainer.getOtype());
        link.setRecordOtype("com.ty.entity.workFlow.FlowTaskRecord");
        this.typlmFlowTaskRecordLinkService.createFlowTaskRecordLink(link);
    }

    public PageInfo<FlowTaskInfo> queryMyToDoTask(Map<String, Object> params, Integer curPage, Integer pageSize) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyToDoTask 方法入参params ==> 【{}】; curPage ==> 【{}】; pageSize ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(params), JSONObject.toJSONString(curPage), JSONObject.toJSONString(pageSize)};
        });
        params.put("assignee", TyplmWorkFlowUtil.getUser().getOid().toString());
        PageInfo<FlowTaskInfo> pageInfo = this.typlmFlowableTaskService.queryTaskByParams(params, curPage, pageSize);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyToDoTask 查询到的流程任务pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        this.setFlowTaskInfo(pageInfo.getList());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyToDoTask 返回的pageInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        return pageInfo;
    }

    public PageInfo<FlowTaskInfo> queryInvolvedFlowList(CommonQuery commonQuery) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryInvolvedFlowList 方法入参commonQuery ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(commonQuery)};
        });
        return this.queryMyLaunchedFlowList(commonQuery);
    }

    public PageInfo<FlowTaskInfo> queryMyLaunchedFlowList(CommonQuery input) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyLaunchedFlowList 方法入参input ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(input)};
        });
        PageInfo<FlowTaskInfo> pageInfo = this.typlmFlowableTaskService.queryWorkFlowByCondition(input);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyLaunchedFlowList 查询到的流程任务pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        Map<String, String> emergencyMap = this.typlmMultilingualExtendService.queryMultilingualByEnumDefName("ChangeUrgency");
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyLaunchedFlowList 查询到的紧急程度枚举emergencyMap <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(emergencyMap)};
        });
        if (!CollectionUtils.isEmpty(emergencyMap)) {
            Iterator var4 = pageInfo.getList().iterator();

            while(var4.hasNext()) {
                FlowTaskInfo flowTaskInfo = (FlowTaskInfo)var4.next();
                this.buildFlowTaskInfo(flowTaskInfo, emergencyMap);
            }
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "queryMyLaunchedFlowList 返回的pageInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        return pageInfo;
    }

    public PageInfo<FlowTaskInfo> queryFlowByBaseObjectOid(WorkFlowContainer input, int page, int limit) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryFlowByBaseObjectOid 方法入参input ==> 【{}】; page ==> 【{}】; limit ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(input), JSONObject.toJSONString(page), JSONObject.toJSONString(limit)};
        });
        Map<String, Object> param = new HashMap();
        param.put("baseObjectOid", input.getBaseObjectOid());
        PageInfo<WorkFlowContainer> pageInfo = this.typlmWorkFlowContainerService.queryPageByParams(param, "createstamp", page, limit);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryFlowByBaseObjectOid 查询出的流程容器pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        Map<String, WorkFlowContainer> processIdMap = (Map)pageInfo.getList().stream().collect(Collectors.toMap(WorkFlowContainer::getFlowableProcessId, (task) -> {
            return task;
        }));
        TyplmLoggerUtil.debug(log, () -> {
            return "queryFlowByBaseObjectOid 查询出的流程容器转换成processIdMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(processIdMap)};
        });
        List<HistoricProcessInstance> processInstanceList = ((HistoricProcessInstanceQuery)this.historyService.createHistoricProcessInstanceQuery().processInstanceIds(processIdMap.keySet()).orderByProcessInstanceStartTime().desc()).list();
        TyplmLoggerUtil.debug(log, () -> {
            return "queryFlowByBaseObjectOid 根据流程Ids查询出流程实例processInstanceList <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(processInstanceList)};
        });
        List<FlowTaskInfo> infos = new ArrayList();
        Iterator var9 = processInstanceList.iterator();

        while(var9.hasNext()) {
            HistoricProcessInstance processInstance = (HistoricProcessInstance)var9.next();
            FlowTaskInfo info = this.buildHistoryProcessInfo(processInstance, (WorkFlowContainer)processIdMap.get(processInstance.getId()));
            infos.add(info);
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "queryFlowByBaseObjectOid 组装的infos ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(infos)};
        });
        PageInfo ret = new PageInfo();
        ret.setPageNum(page);
        ret.setPageSize(limit);
        ret.setTotal(pageInfo.getTotal());
        ret.setList(pageInfo.getList());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryFlowByBaseObjectOid 返回值ret ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(ret)};
        });
        return ret;
    }

    private void buildFlowTaskInfo(FlowTaskInfo flowTaskInfo, Map<String, String> emergencyMap) {
        TyplmLoggerUtil.debug(log, () -> {
            return "buildFlowTaskInfo 方法入参flowTaskInfo ==> 【{}】; emergencyMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo), JSONObject.toJSONString(emergencyMap)};
        });
        if (flowTaskInfo.getWorkFlowContainerCreatorId() != null) {
            PdmUser user = this.pdmUserService.getUserByOid(flowTaskInfo.getWorkFlowContainerCreatorId());
            TyplmLoggerUtil.debug(log, () -> {
                return "buildFlowTaskInfo 获取到的创建人用户user <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(user)};
            });
            flowTaskInfo.setWorkFlowContainerCreatorName(user == null ? "" : user.getFullname());
            flowTaskInfo.setWorkFlowContainerCreatorUserName(user == null ? "" : user.getName());
        }

        flowTaskInfo.setEmergencyDegreeName((String)emergencyMap.get(flowTaskInfo.getEmergencyDegree()));
        BigInteger workFlowContainerOid = flowTaskInfo.getWorkFlowContainerOid();
        String workFlowContainerOtype = flowTaskInfo.getWorkFlowContainerOtype();
        FlowTaskRecord flowTaskRecord = this.typlmFlowTaskRecordService.queryNewestRecordByMaster(workFlowContainerOid, workFlowContainerOtype, "");
        TyplmLoggerUtil.debug(log, () -> {
            return "buildFlowTaskInfo 获取到的流程记录flowTaskRecord <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskRecord)};
        });
        List<UserTask> agentNextTaskLs = new ArrayList();
        Set<BigInteger> userNames = new HashSet();
        Set<String> agentTaskNames = new HashSet();
        if (flowTaskRecord == null) {
            flowTaskInfo.setPreNodeUserName(flowTaskInfo.getWorkFlowContainerCreatorName());
            flowTaskInfo.setPreNodeAccount(flowTaskInfo.getWorkFlowContainerCreatorUserName());
        } else {
            BigInteger operatorOid = flowTaskRecord.getOperatorOid();
            PdmUser pdmUser = this.pdmUserService.getUserByOid(operatorOid);
            TyplmLoggerUtil.debug(log, () -> {
                return "buildFlowTaskInfo 获取到的流程记录的操作人pdmUser <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(pdmUser)};
            });
            flowTaskInfo.setPreNodeUserName(pdmUser.getFullname());
            flowTaskInfo.setPreNodeAccount(pdmUser.getName());
        }

        List<Task> taskLs = ((TaskQuery)this.taskService.createTaskQuery().processInstanceId(flowTaskInfo.getFlowableProcessId())).active().list();
        TyplmLoggerUtil.debug(log, () -> {
            return "buildFlowTaskInfo 获取当前的流程的所有待办taskLs <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(taskLs)};
        });
        Iterator var13 = taskLs.iterator();

        List accountList;
        while(var13.hasNext()) {
            Task ele = (Task)var13.next();
            userNames.add(new BigInteger(ele.getAssignee()));
            agentTaskNames.add(ele.getName());
            accountList = this.typlmFlowElementService.getNextUserTask(ele.getExecutionId(), ele.getProcessDefinitionId());
            List finalAccountList = accountList;
            TyplmLoggerUtil.debug(log, () -> {
                return "buildFlowTaskInfo 获取下一步的用户任务userLs <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(finalAccountList)};
            });
            agentNextTaskLs.addAll(accountList);
        }

        flowTaskInfo.setTaskName(String.join(",", new HashSet(agentTaskNames)));
        if (!userNames.isEmpty()) {
            List<PdmUserDTO> userListByIdList = this.pdmUserService.getUserListByIds(new ArrayList(userNames));
            TyplmLoggerUtil.debug(log, () -> {
                return "buildFlowTaskInfo 获取用户集合userListByIdList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userListByIdList)};
            });
            List<String> nameList = (List)userListByIdList.stream().map(PdmUserDTO::getUsername).collect(Collectors.toList());
            accountList = (List)userListByIdList.stream().map(PdmUserDTO::getAccount).collect(Collectors.toList());
            flowTaskInfo.setCurrentUser(String.join(",", nameList));
            flowTaskInfo.setCurrentAccount(String.join(",", accountList));
        }

        if (!agentNextTaskLs.isEmpty()) {
            this.setNextNodeInfo(flowTaskInfo, workFlowContainerOid, workFlowContainerOtype, agentNextTaskLs);
        }
    }

    private FlowTaskInfo buildHistoryProcessInfo(HistoricProcessInstance task, WorkFlowContainer workFlowContainer) {
        FlowTaskInfo flowTaskInfo = new FlowTaskInfo();
        flowTaskInfo.setTaskId(task.getId());
        flowTaskInfo.setTaskName(task.getProcessDefinitionName());
        flowTaskInfo.setWorkFlowContainerOid(workFlowContainer.getOid());
        flowTaskInfo.setWorkFlowContainerName(workFlowContainer.getName());
        flowTaskInfo.setTaskCreateTime(task.getStartTime());
        PdmUser user = this.pdmUserService.getUserByOid(workFlowContainer.getCreatorOid());
        TyplmLoggerUtil.debug(log, () -> {
            return "buildFlowTaskInfo 获取创建人user <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(user)};
        });
        flowTaskInfo.setWorkFlowContainerCreatorName(user.getName());
        TyplmLoggerUtil.debug(log, () -> {
            return "buildFlowTaskInfo 返回值flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        return flowTaskInfo;
    }

    public PageInfo<FlowTaskInfo> queryTaskList(FolwTaskParam folwTaskParam) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTaskList 方法入参folwTaskParam ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(folwTaskParam)};
        });
        Map<String, Object> flowMap = new HashMap();
        int type = folwTaskParam.getType();
        int pageNum = folwTaskParam.getPageNum();
        int pageSize = folwTaskParam.getPageSize();
        switch (type) {
            case 0:
            case 1:
            case 2:
                flowMap.put("status", type);
                break;
            case 3:
                flowMap.put("creatoroid", TyplmWorkFlowUtil.getUser().getOid());
                break;
            case 4:
                flowMap.put("operatoroid", TyplmWorkFlowUtil.getUser().getOid());
            case 5:
                break;
            default:
                throw WorkFlowErrorCodeEnum.NOT_SUPPORT_TYPE.getException(new Object[]{type});
        }

        flowMap.put("nameStr", folwTaskParam.getNameStr());
        flowMap.put("containerOid", folwTaskParam.getContainerOid());
        flowMap.put("containerOtype", folwTaskParam.getContainerOtype());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTaskList 组装的参数flowMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowMap)};
        });
        PageInfo<WorkFlowContainer> pageInfo = this.typlmWorkFlowContainerDatabaseServiceExt.queryWorkFlowContainerPage(flowMap, pageNum, pageSize);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTaskList 查询出的流程容器pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        List<FlowTaskInfo> flowTaskInfoList = new ArrayList();
        Iterator var8 = pageInfo.getList().iterator();

        while(var8.hasNext()) {
            WorkFlowContainer container = (WorkFlowContainer)var8.next();
            FlowTaskInfo flowTaskInfo = new FlowTaskInfo();
            if (container.getStatus() == 1) {
                List<Task> taskList = ((TaskQuery)this.taskService.createTaskQuery().processInstanceId(container.getFlowableProcessId())).active().list();
                TyplmLoggerUtil.debug(log, () -> {
                    return "queryTaskList 查询出的流程任务taskList <== 【{}】";
                }, () -> {
                    return new Object[]{JSONObject.toJSONString(taskList)};
                });
                if (taskList != null && !taskList.isEmpty()) {
                    Task task = (Task)taskList.get(0);
                    flowTaskInfo = this.getFlowTaskInfo(task, container);
                    WorkFlowContainerView workFlowContainerView = this.typlmWorkFlowContainerService.getWorkFlowContainerDetailByWorkFlowContainer(container);
                    flowTaskInfo.setWorkFlowContainerView(workFlowContainerView);
                    flowTaskInfo.setFlowName(container.getName());
                    flowTaskInfoList.add(flowTaskInfo);
                }
            } else {
                WorkFlowContainerView workFlowContainerView = this.typlmWorkFlowContainerService.getWorkFlowContainerDetailByWorkFlowContainer(container);
                flowTaskInfo.setWorkFlowContainerView(workFlowContainerView);
                flowTaskInfo.setWorkFlowContainerOid(container.getOid());
                flowTaskInfo.setFlowCode(container.getCode());
                flowTaskInfo.setFlowType(container.getType());
                flowTaskInfo.setFlowName(container.getName());
                flowTaskInfo.setTaskCreateTime(container.getCreatestamp());
                Map<String, String> emergencyMap = this.typlmMultilingualExtendService.queryMultilingualByEnumDefName("ChangeUrgency");
                if (!CollectionUtils.isEmpty(emergencyMap)) {
                    flowTaskInfo.setEmergencyDegreeName((String)emergencyMap.get(flowTaskInfo.getEmergencyDegree()));
                }

                flowTaskInfo.setFlowTemplate(container.getWorkFlowName());
                PdmUser user = this.pdmUserService.getUserByOid(container.getCreatorOid());
                flowTaskInfo.setWorkFlowContainerCreatorName(user.getFullname());
                flowTaskInfo.setWorkFlowContainerCreatorUserName(user.getName());
                flowTaskInfo.setNeedTime(container.getNeedDate());
                flowTaskInfoList.add(flowTaskInfo);
            }
        }

        PageInfo page = new PageInfo();
        page.setPageNum(pageNum);
        page.setPageSize(pageSize);
        page.setTotal(pageInfo.getTotal());
        page.setList(flowTaskInfoList);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTaskList 返回值page ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(page)};
        });
        return page;
    }

    public PageInfo<FlowTaskInfo> queryWorkFlowDone(CommonQuery commonQuery) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryWorkFlowDone 方法入参commonQuery ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(commonQuery)};
        });
        return this.queryMyLaunchedFlowList(commonQuery);
    }

    public PageInfo<FlowTaskInfo> querySupervisoryFlow(CommonQuery commonQuery, String usage) {
        TyplmLoggerUtil.debug(log, () -> {
            return "querySupervisoryFlow 方法入参commonQuery ==> 【{}】; usage ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(commonQuery), usage};
        });
        if (commonQuery.getQueryConditions() == null) {
            commonQuery.setQueryConditions(new HashMap());
        }

        Map<String, Object> queryConditions = commonQuery.getQueryConditions();
        this.initWorkFlowParams(queryConditions, usage);
        PageInfo<FlowTaskInfo> pageInfo = this.typlmFlowableTaskService.queryWorkFlowByParams(commonQuery);
        TyplmLoggerUtil.debug(log, () -> {
            return "querySupervisoryFlow 查询出的流程任务pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        List<FlowTaskInfo> list = pageInfo.getList();
        Iterator var6 = list.iterator();

        while(var6.hasNext()) {
            FlowTaskInfo flowTaskInfo = (FlowTaskInfo)var6.next();
            this.setMoreTaskInfo(flowTaskInfo);
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "querySupervisoryFlow 返回值pageInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        return pageInfo;
    }

    private void initWorkFlowParams(Map<String, Object> params, String usage) {
        TyplmLoggerUtil.debug(log, () -> {
            return "initWorkFlowParams 方法入参params ==> 【{}】; usage ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(params), usage};
        });
        Object flowContainerOidObj = params.get("flowContainerOid");
        if (flowContainerOidObj != null && !(flowContainerOidObj instanceof BigInteger)) {
            try {
                BigInteger flowContainerOid = new BigInteger(flowContainerOidObj.toString());
                params.put("flowContainerOid", flowContainerOid);
            } catch (NumberFormatException var5) {
                params.remove("flowContainerOid");
            }
        }

        params.put("usage", usage);
        params.put("refObjectOid", TyplmWorkFlowUtil.getUser().getOid());
        params.put("refObjectOtype", "ty.inteplm.org.CTyUser");
    }

    private void setMoreTaskInfo(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreTaskInfo 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        String processDefId = flowTaskInfo.getProcessDefId();
        String taskDefKey = flowTaskInfo.getTaskDefKey();
        boolean userIsCreator = this.typlmFlowElementService.checkUserIsCreator(processDefId, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreTaskInfo 处理人为创建人userIsCreator <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(userIsCreator)};
        });
        flowTaskInfo.setDeliverable(!userIsCreator);
        boolean containerViewEditable = this.typlmFlowElementService.checkContainerViewEditable(processDefId, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreTaskInfo 节点是否允许编辑containerViewEditable <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(containerViewEditable)};
        });
        flowTaskInfo.setEditable(containerViewEditable);
        Map<String, String> emergencyMap = this.typlmMultilingualExtendService.queryMultilingualByEnumDefName("ChangeUrgency");
        TyplmLoggerUtil.debug(log, () -> {
            return "setMoreTaskInfo 获取到的紧急程度枚举emergencyMap <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(emergencyMap)};
        });
        if (!CollectionUtils.isEmpty(emergencyMap)) {
            flowTaskInfo.setEmergencyDegreeName((String)emergencyMap.get(flowTaskInfo.getEmergencyDegree()));
        }

    }

    public PageInfo<FlowTaskInfo> queryTableSupervisoryFlow(CommonQuery commonQuery, String usage) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTableSupervisoryFlow 方法入参commonQuery ==> 【{}】; usage ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(commonQuery), usage};
        });
        if (commonQuery.getQueryConditions() == null) {
            commonQuery.setQueryConditions(new HashMap());
        }

        Map<String, Object> queryConditions = commonQuery.getQueryConditions();
        this.initWorkFlowParams(queryConditions, usage);
        PageInfo<FlowTaskInfo> pageInfo = this.typlmFlowableTaskService.queryWorkFlowByParams(commonQuery);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTableSupervisoryFlow 查询出的流程任务pageInfo <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        this.setFlowTaskInfo(pageInfo.getList());
        TyplmLoggerUtil.debug(log, () -> {
            return "queryTableSupervisoryFlow 返回值pageInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(pageInfo)};
        });
        return pageInfo;
    }

    public Integer countWorkFlowByParams(Map<String, Object> params, String usage) {
        if (TyAccountContext.isDebug()) {
            log.info("countWorkFlowByParams 方法入参params ==> 【{}】; usage ==> 【{}】", JSONObject.toJSONString(params), usage);
        }

        if (params == null) {
            params = new HashMap();
        }

        this.initWorkFlowParams((Map)params, usage);
        return this.typlmFlowableTaskService.countWorkFlowByParams((Map)params);
    }

    public void queryMoreTaskInfo(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMoreTaskInfo 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        String processDefId = flowTaskInfo.getProcessDefId();
        String taskDefKey = flowTaskInfo.getTaskDefKey();
        BigInteger workFlowContainerOid = flowTaskInfo.getWorkFlowContainerOid();
        String workFlowContainerOtype = flowTaskInfo.getWorkFlowContainerOtype();
        FlowTaskRecord flowTaskRecord = this.typlmFlowTaskRecordService.queryNewestRecordByMaster(workFlowContainerOid, workFlowContainerOtype, taskDefKey);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMoreTaskInfo 获取到的流程处理记录flowTaskRecord <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskRecord)};
        });
        if (flowTaskRecord != null) {
            BigInteger operatorOid = flowTaskRecord.getOperatorOid();
            PdmUser pdmUser = this.pdmUserService.getUserByOid(operatorOid);
            flowTaskInfo.setPreNodeUserName(pdmUser.getFullname());
            flowTaskInfo.setPreNodeAccount(pdmUser.getName());
            flowTaskInfo.setPreNodeName(flowTaskRecord.getTaskName());
            flowTaskInfo.setPreNodeFinishTime(flowTaskRecord.getCreateTime());
        } else {
            flowTaskInfo.setPreNodeUserName(flowTaskInfo.getWorkFlowContainerCreatorName());
            flowTaskInfo.setPreNodeAccount(flowTaskInfo.getWorkFlowContainerCreatorUserName());
        }

        List<UserTask> nextUserTask = this.typlmFlowElementService.getNextUserTask(flowTaskInfo.getExecutionId(), processDefId);
        TyplmLoggerUtil.debug(log, () -> {
            return "queryMoreTaskInfo 获取到的下一步的节点nextUserTask <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(nextUserTask)};
        });
        if (!nextUserTask.isEmpty()) {
            this.setNextNodeInfo(flowTaskInfo, workFlowContainerOid, workFlowContainerOtype, nextUserTask);
        }
    }

    public void saveTaskUserList(FlowTaskInfo flowTaskInfo) {
        TyplmLoggerUtil.debug(log, () -> {
            return "saveTaskUserList 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
        if (workFlowContainerView == null) {
            throw WorkFlowErrorCodeEnum.FLOW_PARAMS_NOT_EXIST.getException(new Object[0]);
        } else {
            BigInteger workFlowContainerId = workFlowContainerView.getOid();
            ArgumentUtils.checkArgumentNull(workFlowContainerId, "流程容器oid");
            ArgumentUtils.checkArgumentNull(workFlowContainerView.getOtype(), "流程容器otype");
            WorkFlowContainer workFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowContainerId);
            TyplmLoggerUtil.debug(log, () -> {
                return "saveTaskUserList 查询出来的流程容器workFlowContainer ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(workFlowContainer)};
            });
            if (workFlowContainer == null) {
                throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[]{workFlowContainerId});
            } else if (workFlowContainer.getStatus() != 1) {
                throw WorkFlowErrorCodeEnum.FLOW_STATUS_IS_NOT_RUNNING.getException(new Object[0]);
            } else {
                this.typlmWorkFlowContainerService.updateObjectLinkDistributeObjectsByFlowTaskInfo(flowTaskInfo);
                this.typlmFlowTaskUserService.updateUserTaskList(workFlowContainerView);
            }
        }
    }

    public List<ParticipantsDTO> getParticipantsNewInfo(List<ParticipantsDTO> participants) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getParticipantsNewInfo 方法入参participants ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(participants)};
        });
        ArgumentUtils.checkArgumentEmpty(participants, "参与者信息participants");
        List<TyException> exceptionList = new ArrayList();
        if (participants.stream().anyMatch((item) -> {
            return StringUtils.isBlank(item.getOtype());
        })) {
            exceptionList.add(new TyException(ResponseCodeEnum.ACC_PARAMETER_IS_NULL, new String[]{"otype"}));
        }

        if (participants.stream().anyMatch((item) -> {
            return EntityBaseUtil.isEmptyOid(item.getOid()) && StringUtils.isBlank(item.getKey());
        })) {
            exceptionList.add(new TyException(ResponseCodeEnum.ACC_PARAMETER_AT_LEAST_NOT_EMPTY, new String[]{"oid,key"}));
        }

        if (ObjectUtils.isNotEmpty(exceptionList)) {
            throw new TyException(exceptionList);
        } else {
            Map<String, List<ParticipantsDTO>> typeMap = (Map)participants.stream().collect(Collectors.groupingBy(ParticipantsDTO::getOtype));
            this.handleParticipantsUser(participants, typeMap);
            this.handleParticipantsRole(participants, typeMap);
            this.handleParticipantsGroup(participants, typeMap);
            TyplmLoggerUtil.debug(log, () -> {
                return "getParticipantsNewInfo 返回值participants ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(participants)};
            });
            return participants;
        }
    }

    private void handleParticipantsUser(List<ParticipantsDTO> participants, Map<String, List<ParticipantsDTO>> typeMap) {
        TyplmLoggerUtil.debug(log, () -> {
            return "handleParticipantsUser 方法入参participants ==> 【{}】; typeMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(participants), JSONObject.toJSONString(typeMap)};
        });
        List<ParticipantsDTO> users = (List)typeMap.get("ty.inteplm.org.CTyUser");
        TyplmLoggerUtil.debug(log, () -> {
            return "handleParticipantsUser 获取到参与者里面的用户users ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(users)};
        });
        if (!CollectionUtils.isEmpty(users)) {
            List<BigInteger> userIds = (List)users.stream().map(ParticipantsDTO::getOid).collect(Collectors.toList());
            List<PdmUserDTO> userList = this.pdmUserService.getUserListByIds(userIds);
            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsUser 按照oid重新查询用户信息userList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userList)};
            });
            if (CollectionUtils.isEmpty(userList)) {
                return;
            }

            Map<String, PdmUserDTO> userMap = (Map)userList.stream().collect(Collectors.toMap(PdmUserDTO::getOid, (t) -> {
                return t;
            }, (k1, k2) -> {
                return k1;
            }));
            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsUser 转换成userMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(userMap)};
            });
            List<ParticipantsDTO> deleteList = new ArrayList();
            Iterator var8 = users.iterator();

            while(var8.hasNext()) {
                ParticipantsDTO participantsDTO = (ParticipantsDTO)var8.next();
                PdmUserDTO pdmUserDTO = (PdmUserDTO)userMap.get(participantsDTO.getOid().toString());
                if (ObjectUtils.isNotEmpty(pdmUserDTO)) {
                    participantsDTO.setName(pdmUserDTO.getUsername());
                    participantsDTO.setAccount(pdmUserDTO.getAccount());
                } else {
                    deleteList.add(participantsDTO);
                }
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsUser 需要移除的参与者deleteList ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(deleteList)};
            });
            if (!CollectionUtils.isEmpty(deleteList)) {
                participants.removeAll(deleteList);
            }
        }

    }

    private void handleParticipantsRole(List<ParticipantsDTO> participants, Map<String, List<ParticipantsDTO>> typeMap) {
        TyplmLoggerUtil.debug(log, () -> {
            return "handleParticipantsRole 方法入参participants ==> 【{}】; typeMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(participants), JSONObject.toJSONString(typeMap)};
        });
        List<ParticipantsDTO> roles = (List)typeMap.get("ty.inteplm.org.CTyRole");
        TyplmLoggerUtil.debug(log, () -> {
            return "handleParticipantsRole 获取到参与者里面的角色roles ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(roles)};
        });
        if (!CollectionUtils.isEmpty(roles)) {
            PageUserIdQuery query = new PageUserIdQuery();
            query.setPage(1);
            query.setSize(10000);
            Pager<RoleDO> allRoleByPage = this.typlmRoleExtendService.getAllRoleByPage(query);
            List<RoleDO> roleList = allRoleByPage.getData();
            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsRole 查询出所有的角色信息allRoleByPage <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(allRoleByPage)};
            });
            if (CollectionUtils.isEmpty(roleList)) {
                return;
            }

            Map<String, RoleDO> roleMap = (Map)roleList.stream().collect(Collectors.toMap(RoleDO::getRolekey, (t) -> {
                return t;
            }, (k1, k2) -> {
                return k1;
            }));
            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsRole 转换成roleMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(roleMap)};
            });
            List<ParticipantsDTO> deleteList = new ArrayList();
            Iterator var9 = roles.iterator();

            while(var9.hasNext()) {
                ParticipantsDTO participantsDTO = (ParticipantsDTO)var9.next();
                RoleDO roleDO = (RoleDO)roleMap.get(participantsDTO.getKey());
                if (ObjectUtils.isNotEmpty(roleDO)) {
                    participantsDTO.setName(roleDO.getName());
                } else {
                    deleteList.add(participantsDTO);
                }
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsRole 需要移除的参与者deleteList ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(deleteList)};
            });
            if (!CollectionUtils.isEmpty(deleteList)) {
                participants.removeAll(deleteList);
            }
        }

    }

    private void handleParticipantsGroup(List<ParticipantsDTO> participants, Map<String, List<ParticipantsDTO>> typeMap) {
        TyplmLoggerUtil.debug(log, () -> {
            return "handleParticipantsGroup 方法入参participants ==> 【{}】; typeMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(participants), JSONObject.toJSONString(typeMap)};
        });
        List<ParticipantsDTO> groups = (List)typeMap.get("ty.inteplm.org.CTyGroup");
        TyplmLoggerUtil.debug(log, () -> {
            return "handleParticipantsGroup 获取到参与者里面的群组groups ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(groups)};
        });
        if (!CollectionUtils.isEmpty(groups)) {
            List<String> groupIds = (List)groups.stream().map(ParticipantsDTO::getOid).map(BigInteger::toString).collect(Collectors.toList());
            List<GroupDO> groupList = this.typlmGroupService.getGroupByOidList(groupIds);
            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsGroup 按照oid重新查询群组信息groupList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(groupList)};
            });
            if (CollectionUtils.isEmpty(groupList)) {
                return;
            }

            Map<BigInteger, GroupDO> groupMap = (Map)groupList.stream().collect(Collectors.toMap(CTyEntityBaseDO::getOid, (groupDOx) -> {
                return groupDOx;
            }, (k1, k2) -> {
                return k1;
            }));
            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsGroup 转换成groupMap ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(groupMap)};
            });
            List<ParticipantsDTO> deleteList = new ArrayList();
            Iterator var8 = groups.iterator();

            while(var8.hasNext()) {
                ParticipantsDTO participantsDTO = (ParticipantsDTO)var8.next();
                GroupDO groupDO = (GroupDO)groupMap.get(participantsDTO.getOid());
                if (ObjectUtils.isNotEmpty(groupDO)) {
                    participantsDTO.setName(groupDO.getName());
                } else {
                    deleteList.add(participantsDTO);
                }
            }

            TyplmLoggerUtil.debug(log, () -> {
                return "handleParticipantsGroup 需要移除的参与者deleteList ==> 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(deleteList)};
            });
            if (!CollectionUtils.isEmpty(deleteList)) {
                participants.removeAll(deleteList);
            }
        }

    }

    public List<TyplmTaskVO> getActiveTaskList(String processInstanceId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getActiveTaskList 方法入参processInstanceId ==> 【{}】";
        }, () -> {
            return new Object[]{processInstanceId};
        });
        List<Task> list = ((TaskQuery)this.taskService.createTaskQuery().processInstanceId(processInstanceId)).list();
        List<TyplmTaskVO> typlmTaskList = new ArrayList();
        Iterator var4 = list.iterator();

        while(var4.hasNext()) {
            Task task = (Task)var4.next();
            TyplmTaskVO typlmTaskVO = new TyplmTaskVO();
            typlmTaskVO.setAssignee(task.getAssignee());
            typlmTaskVO.setCreateTime(task.getCreateTime());
            typlmTaskVO.setExecutionId(task.getExecutionId());
            typlmTaskVO.setTaskDefinitionKey(task.getTaskDefinitionKey());
            typlmTaskVO.setOwner(task.getOwner());
            typlmTaskVO.setName(task.getName());
            typlmTaskList.add(typlmTaskVO);
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "getActiveTaskList 返回值typlmTaskList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(typlmTaskList)};
        });
        return typlmTaskList;
    }

    public Map<String, List<String>> processRecord(String processInstanceId) {
        TyplmLoggerUtil.debug(log, () -> {
            return "processRecord 方法入参processInstanceId ==> 【{}】";
        }, () -> {
            return new Object[]{processInstanceId};
        });
        Map<String, List<String>> highlightMap = new HashMap();
        List<HistoricActivityInstance> historicActivityInstanceList = ((HistoricActivityInstanceQuery)this.historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc()).list();
        BpmnModel bpmnModel = this.repositoryService.getBpmnModel(((HistoricActivityInstance)historicActivityInstanceList.get(0)).getProcessDefinitionId());
        TyplmLoggerUtil.debug(log, () -> {
            return "processRecord 获取流程定义bpmnModel <== 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(bpmnModel)};
        });
        List<String> historyHighLightedActiveIdList = new ArrayList();
        Iterator var6 = historicActivityInstanceList.iterator();

        while(var6.hasNext()) {
            HistoricActivityInstance historicActivityInstance = (HistoricActivityInstance)var6.next();
            if (historicActivityInstance.getEndTime() != null && !WorkFlowContainerStatusEnum.EXPIRE_AUTO_COMPLETED.getName().equals(historicActivityInstance.getDeleteReason()) && !"管理员终止".equals(historicActivityInstance.getDeleteReason())) {
                historyHighLightedActiveIdList.add(historicActivityInstance.getActivityId());
            }
        }

        historyHighLightedActiveIdList.addAll(this.getHighLightedFlows(bpmnModel, historicActivityInstanceList));
        highlightMap.put("history", historyHighLightedActiveIdList);
        List<Execution> runningActivityInstanceList = this.runtimeService.createExecutionQuery().processInstanceId(processInstanceId).list();
        List<String> runningActivityIdList = new ArrayList();
        Iterator var8 = runningActivityInstanceList.iterator();

        while(var8.hasNext()) {
            Execution execution = (Execution)var8.next();
            if (StringUtils.isNotEmpty(execution.getActivityId())) {
                runningActivityIdList.add(execution.getActivityId());
            }
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "processRecord 正在执行的节点id集合runningActivityIdList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(runningActivityIdList)};
        });
        if (CollUtil.isNotEmpty(runningActivityIdList)) {
            highlightMap.put("runtime", runningActivityIdList);
        }

        TyplmLoggerUtil.debug(log, () -> {
            return "processRecord 返回值highlightMap ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(highlightMap)};
        });
        return highlightMap;
    }

    public void completeTask(FlowTaskInfo flowTaskInfo, List<MultipartFile> fileList, boolean updateFlowObject) {
        TyplmLoggerUtil.debug(log, () -> {
            return "completeTask 方法入参flowTaskInfo ==> 【{}】; updateFlowObject ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo), JSONObject.toJSONString(updateFlowObject)};
        });
        String taskId = flowTaskInfo.getTaskId();
        this.taskService.setVariable(taskId,"taskId",taskId);

        Task task = this.getNonTask(taskId);
        this.typlmWorkFlowContainerService.checkContainerEnableNext(flowTaskInfo);
        this.setTaskRouterList(flowTaskInfo);
        List<String> routerCheckList = flowTaskInfo.getRouterCheckList();
        TyplmLoggerUtil.debug(log, () -> {
            return "completeTask 路由选择routerCheckList ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(routerCheckList)};
        });
        if (CollectionUtils.isEmpty(routerCheckList)) {
            throw SystemErrorCodeEnum.NO_ROUTER_CHOOSE.getException(new Object[0]);
        } else if (Boolean.FALSE.equals(flowTaskInfo.getMultiRouterCheck()) && routerCheckList.size() > 1) {
            throw SystemErrorCodeEnum.USER_TASK_NO_SUPPORT_MULTI_ROUTER.getException(new Object[0]);
        } else {
            WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
            if (updateFlowObject) {
                this.typlmWorkFlowContainerService.updateByFlowTaskInfo(flowTaskInfo, fileList);
            }

            List<UserTask> enableSetUserTaskList = this.typlmFlowElementService.getEnableSetUserTask(task);
            TyplmLoggerUtil.debug(log, () -> {
                return "completeTask 获取当前节点可以设置的其他节点enableSetUserTaskList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(enableSetUserTaskList)};
            });
            this.typlmFlowTaskUserService.checkRequireSetting(workFlowContainerView, enableSetUserTaskList);
            List<Router> routerList = flowTaskInfo.getRouterList();
            Map<String, Router> routerMap = (Map)routerList.stream().collect(Collectors.toMap(Router::getValue, (routerx) -> {
                return routerx;
            }));
            List<String> routerResult = new ArrayList();
            List<String> targetRouter = new ArrayList();
            Iterator var13 = routerCheckList.iterator();

            String operateTarget;
            while(var13.hasNext()) {
                operateTarget = (String)var13.next();
                Router router = (Router)routerMap.get(operateTarget);
                if (router == null) {
                    throw SystemErrorCodeEnum.NO_SUPPORT_ROUTER.getException(new Object[0]);
                }

                String routerCountKey = CountHandler.getTotalKey(operateTarget);
                Object variable = this.taskService.getVariable(taskId, routerCountKey);
                int routerCount = Objects.isNull(variable) ? 0 : Integer.parseInt(variable.toString());
                ++routerCount;
                this.taskService.setVariable(taskId, routerCountKey, routerCount);
                routerResult.add(router.getLabel());
                targetRouter.add(router.getTarget());
            }

            this.saveFlowVariable(flowTaskInfo);
            String operateName = String.join(",", routerResult);
            operateTarget = String.join(",", targetRouter);
            this.taskService.setVariableLocal(taskId, "operateName", operateName);
            this.typlmFlowTaskUserService.updateUserTaskList(workFlowContainerView);
            List<UserTaskDTO> userTaskList = workFlowContainerView.getUserTaskList();
            this.dealUserTask(task, userTaskList);
            this.validateParticipantExistInReuiredUserTask(userTaskList);
            this.taskService.removeVariable(taskId, "remark");
            this.taskService.removeVariable(taskId, "routerCheck");
            this.dealVariableByStrategy(task, workFlowContainerView, routerCheckList);

            String message;
            try {
                FlowTaskRecord taskRecord = this.beforeProcessFinished(task, operateName, operateTarget, workFlowContainerView, new ApprovalOpinionDTO(flowTaskInfo.getRemark(), flowTaskInfo.getApprovalOpinion()));
                this.batchSaveContentData(flowTaskInfo, workFlowContainerView, taskRecord);
                List<BigInteger> carbonCopyUserOidList = flowTaskInfo.getCarbonCopyUserOidList();
                if (!CollectionUtils.isEmpty(carbonCopyUserOidList)) {
                    OperateTaskView operateTaskView = new OperateTaskView();
                    operateTaskView.setTaskId(taskId);
                    operateTaskView.setUserOids(carbonCopyUserOidList);
                    this.typlmWorkFlowtOperateTaskService.createCarbonCopyTask(operateTaskView);
                }

                this.taskService.complete(taskId);
            } catch (FlowableIllegalArgumentException var19) {
                log.info("流程引擎异常", var19);
                message = task.getProcessDefinitionId();
                this.handleFlowableException(message, var19);
            } catch (FlowableException var20) {
                log.info("流程引擎异常", var20);
                message = var20.getMessage();
                if (message.contains("No outgoing sequence flow")) {
                    throw WorkFlowErrorCodeEnum.NO_OUTGOING_SEQUENCE_FLOW.getException(new Object[0]);
                }

                if (message.contains("Exception while invoking TaskListener")) {
                    message = message.replace("Exception while invoking TaskListener", "任务监听执行出现问题");
                }

                throw WorkFlowErrorCodeEnum.EXCEPTION_WHILE_INVOKING_TASK_LISTENER.getException(new Object[]{message});
            }

            this.sendMessage(flowTaskInfo, (BigInteger)null, flowTaskInfo.getWorkFlowContainerOid().toString(), "完成");
        }
    }

    public FlowTaskInfo getTaskDetailView(String taskId, boolean isSimple) {
        TyplmLoggerUtil.debug(log, () -> {
            return "getTaskDetailView 方法入参taskId ==> 【{}】; isSimple ==> 【{}】";
        }, () -> {
            return new Object[]{taskId, JSONObject.toJSONString(isSimple)};
        });
        Task task = (Task)((TaskQuery)this.taskService.createTaskQuery().taskId(taskId)).singleResult();
        if (task == null) {
            HistoricTaskInstance historicTaskInstance = (HistoricTaskInstance)((HistoricTaskInstanceQuery)this.historyService.createHistoricTaskInstanceQuery().taskId(taskId)).singleResult();
            if (historicTaskInstance != null) {
                throw SystemErrorCodeEnum.TASK_COMPLETED.getException(new Object[]{historicTaskInstance.getName()});
            } else {
                throw SystemErrorCodeEnum.TASK_COMPLETED.getException(new Object[0]);
            }
        } else {
            String processInstanceId = task.getProcessInstanceId();
            WorkFlowContainer workFlowContainer = this.typlmWorkFlowContainerService.getWorkFlowContainerByFlowableProcessId(processInstanceId);
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取到的流程容器workFlowContainer <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(workFlowContainer)};
            });
            FlowTaskInfo flowTaskInfo = this.getFlowTaskInfo(task, workFlowContainer);
            flowTaskInfo.setFlowableProcessId(processInstanceId);
            WorkFlowContainerView workFlowContainerView = null;
            if (isSimple) {
                workFlowContainerView = this.typlmWorkFlowContainerService.getWorkFlowContainerSimpleDetailByWorkFlowContainer(workFlowContainer);
            } else {
                workFlowContainerView = this.typlmWorkFlowContainerService.getWorkFlowContainerDetailByWorkFlowContainer(workFlowContainer, flowTaskInfo);
            }

            flowTaskInfo.setWorkFlowContainerView(workFlowContainerView);
            List<FlowVariableDTO> flowVariableDTOList = this.getFlowVariableList(workFlowContainerView, flowTaskInfo);
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取到的流程变量flowVariableDTOList <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(flowVariableDTOList)};
            });
            flowTaskInfo.setFlowVariableDTOList(flowVariableDTOList);
            this.setTaskRouterList(flowTaskInfo);
            Object remark = this.taskService.getVariable(taskId, "remark");
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取保存的处理意见remark <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(remark)};
            });
            if (ObjectUtils.isNotEmpty(remark)) {
                flowTaskInfo.setRemark(remark.toString());
            }

            Object routerCheck = this.taskService.getVariable(taskId, "routerCheck");
            TyplmLoggerUtil.debug(log, () -> {
                return "getTaskDetailView 获取保存的已选择路由routerCheck <== 【{}】";
            }, () -> {
                return new Object[]{JSONObject.toJSONString(routerCheck)};
            });
            if (ObjectUtils.isNotEmpty(routerCheck)) {
                List<String> checkedRouter = Arrays.asList(routerCheck.toString().split(","));
                flowTaskInfo.setRouterCheckList(checkedRouter);
            }

            return flowTaskInfo;
        }
    }

    public List<Router> queryRouterList(String taskId) {
        Task task = (Task)((TaskQuery)this.taskService.createTaskQuery().taskId(taskId)).singleResult();
        if (task == null) {
            return new ArrayList();
        } else {
            FlowTaskInfo flowTaskInfo = new FlowTaskInfo();
            flowTaskInfo.setFlowableProcessId(task.getProcessInstanceId());
            flowTaskInfo.setTaskDefKey(task.getTaskDefinitionKey());
            Process process = this.typlmFlowElementService.getProcessByFlowTaskInfo(flowTaskInfo);
            UserTask userTask = this.getUserTask(process, flowTaskInfo.getTaskDefKey());
            return this.getRouterList(userTask, process);
        }
    }

    public void withdrawProcess(WithdrawProcessVO withdrawProcessVO) {
        WorkFlowContainer workFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(withdrawProcessVO.getWorkFlowContainerId());
        if (workFlowContainer == null) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[]{withdrawProcessVO.getWorkFlowContainerId()});
        } else {
            this.checkCreator(workFlowContainer);
            String flowableProcessId = workFlowContainer.getFlowableProcessId();
            if (StringUtils.isEmpty(flowableProcessId)) {
                throw WorkFlowErrorCodeEnum.FLOW_PROCESS_ID_IS_EMPTY.getException(new Object[0]);
            } else {
                List<Task> list = ((TaskQuery)this.taskService.createTaskQuery().processInstanceId(workFlowContainer.getFlowableProcessId())).list();
                boolean shouldHoldhistoryprocessrecord = true;
                List<WorkFlowExpand> workFlowExpands = this.typlmWorkFlowExpandService.queryWorkFlowExpandByWorkFlowId(Collections.singleton(workFlowContainer.getDeploymentId()));
                if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(workFlowExpands)) {
                    Map<String, WorkFlowExpand> workFlowExpandMap = (Map)workFlowExpands.stream().collect(Collectors.toMap(WorkFlowExpand::getDeploymentId, Function.identity(), (a, b) -> {
                        return b;
                    }));
                    WorkFlowExpand workFlowExpand = (WorkFlowExpand)workFlowExpandMap.get(workFlowContainer.getDeploymentId());
                    JSONObject jsonObject = JSON.parseObject(workFlowExpand.getProcessWithdrawConfig());
                    shouldHoldhistoryprocessrecord = jsonObject.getBoolean("holdhistoryprocessrecord");
                    List<WithDrawProcessUserTaskVO> usertasks = jsonObject.getJSONArray("usertask").toJavaList(WithDrawProcessUserTaskVO.class);
                    Set<String> taskDefKeys = (Set)list.stream().map(TaskInfo::getTaskDefinitionKey).collect(Collectors.toSet());
                    boolean anyMatch = false;
                    List<String> matchedUserTasks = new ArrayList();
                    Iterator var14 = usertasks.iterator();

                    while(var14.hasNext()) {
                        WithDrawProcessUserTaskVO usertask = (WithDrawProcessUserTaskVO)var14.next();
                        if (taskDefKeys.contains(usertask.getTaskdefkey())) {
                            matchedUserTasks.add(usertask.getName());
                            anyMatch = true;
                        }
                    }

                    if (anyMatch) {
                        throw WorkFlowErrorCodeEnum.USER_TASK_EXECUTION_REACHED_NODE_WITHDRAW_NOT_ALLOWED.getException(new Object[]{String.join(",", matchedUserTasks)});
                    }
                }

                this.handleSubWorkFlowContainer(workFlowContainer, "", false);
                workFlowContainer = this.findRootWorkFlowContainer(workFlowContainer);
                String deploymentId = workFlowContainer.getDeploymentId();
                if (StringUtils.isBlank(deploymentId)) {
                    throw WorkFlowErrorCodeEnum.DEPLOYMENT_ID_IS_EMPTY.getException(new Object[0]);
                } else {
                    ProcessInstance processInstance = (ProcessInstance)this.runtimeService.createProcessInstanceQuery().processInstanceId(flowableProcessId).singleResult();
                    if (processInstance == null) {
                        throw WorkFlowErrorCodeEnum.PROCESS_INSTANCE_NOT_EXIST.getException(new Object[0]);
                    } else {
                        Process process = this.obtainMainProcessByDeploymentId(workFlowContainer.getDeploymentId());
                        DelegateExecution delegateExecution = (DelegateExecution)this.runtimeService.createExecutionQuery().executionId(flowableProcessId).singleResult();
                        ManagementService managementService = (ManagementService)TySpringBeanUtil.getBean(ManagementService.class);
                        List<FlowableListener> beforeWithdrawUserTaskListeners = this.getActivedUserTaskListeners(list, process, "beforeWithdrawUserTask");
                        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(beforeWithdrawUserTaskListeners)) {
                            process.getExecutionListeners().addAll(beforeWithdrawUserTaskListeners);
                            managementService.executeCommand(new ExecuteListenCmd(delegateExecution, beforeWithdrawUserTaskListeners, process, "beforeWithdrawUserTask"));
                            log.info("excute excutionListener before withdrawprocessusertask");
                        } else {
                            this.invokeListener(process, "beforeWithdrawProcess", managementService, delegateExecution);
                            log.info("excute excutionListener before withdrawprocess");
                        }

                        this.runtimeService.suspendProcessInstanceById(flowableProcessId);
                        this.runtimeService.deleteProcessInstance(flowableProcessId, "撤销至草稿");
                        workFlowContainer.setStatus(WorkFlowContainerStatusEnum.NO_START.getValue());
                        workFlowContainer.setFlowableProcessId((String)null);
                        this.typlmWorkFlowContainerService.update(workFlowContainer);
                        this.typlmFlowContainerObjectService.handleWithdrawProcessFlowContainerObject(workFlowContainer);
                        this.taskService.deleteTasks((Collection)list.stream().map(TaskInfo::getId).collect(Collectors.toSet()));
                        log.info("delete userTask in withdrawprocess");
                        List<FlowTaskRecord> afterWithdrawUserTaskListeners1;
                        if (!shouldHoldhistoryprocessrecord) {
                            afterWithdrawUserTaskListeners1 = this.typlmFlowTaskRecordService.queryFlowTaskRecordListByMaster(workFlowContainer.getOid(), workFlowContainer.getOtype());
                            if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(afterWithdrawUserTaskListeners1)) {
                                Set<BigInteger> collect = (Set)afterWithdrawUserTaskListeners1.stream().map(FlowTaskRecord::getOid).collect(Collectors.toSet());
                                this.typlmFlowTaskRecordService.delete(collect);
                            }

                            Example example = new Example(FlowTaskRecordLink.class, true, true);
                            Example.Criteria criteria = example.createCriteria();
                            criteria.andEqualTo("masterObjectOid", workFlowContainer.getOid());
                            criteria.andEqualTo("masterObjectOtype", workFlowContainer.getOtype());
                            criteria.andEqualTo("recordOtype", "com.ty.entity.workFlow.FlowTaskRecord");
                            this.typlmFlowTaskRecordLinkMapper.deleteByExample(example);
                        }

                        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
                            Set<String> taskDefKeys = (Set)list.stream().map(TaskInfo::getTaskDefinitionKey).collect(Collectors.toSet());
                            String processDefinitionId = ((Task)list.get(0)).getProcessDefinitionId();
                            Iterator var30 = taskDefKeys.iterator();

                            while(var30.hasNext()) {
                                String taskDefKey = (String)var30.next();
                                UserTask userTask = this.typlmFlowElementService.getUserTask(processDefinitionId, taskDefKey);
                                this.createWorkFlowRecord(withdrawProcessVO, userTask, workFlowContainer, taskDefKey);
                            }
                        }

                        List<FlowableListener> afterWithdrawUserTaskListeners = this.getActivedUserTaskListeners(list, process, "afterWithdrawUserTask");
                        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(afterWithdrawUserTaskListeners)) {
                            process.getExecutionListeners().addAll(afterWithdrawUserTaskListeners);
                            managementService.executeCommand(new ExecuteListenCmd(delegateExecution, afterWithdrawUserTaskListeners, process, "afterWithdrawUserTask"));
                            log.info("excute excutionListener after withdrawprocessusertask");
                        } else {
                            this.invokeListener(process, "afterWithdrawProcess", managementService, delegateExecution);
                            log.info("excute excutionListener after withdrawprocess");
                        }

                    }
                }
            }
        }
    }

    private void checkCreator(WorkFlowContainer workFlowContainer) {
        UserDO user = TyplmWorkFlowUtil.getUser();
        if (user.getOid().compareTo(workFlowContainer.getCreatorOid()) != 0) {
            throw WorkFlowErrorCodeEnum.USER_CAN_NOT_WITHDRAW_PROCESS.getException(new Object[]{user.getFullname()});
        }
    }

    public FlowTaskRecordAndContentVO queryFlowTaskRecordForCurrentbatch(List<String> taskdefkeys, BigInteger workFlowcontainerOid) {
        WorkFlowContainer workFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowcontainerOid);
        if (workFlowContainer == null) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_CONTAINER_NOT_EXIST.getException(new Object[]{workFlowcontainerOid});
        } else if (workFlowContainer.getStatus().compareTo(1) > 0) {
            throw WorkFlowErrorCodeEnum.WORK_FLOW_TERMINATED_OR_COMPLETED.getException(new Object[0]);
        } else {
            String flowableProcessId = workFlowContainer.getFlowableProcessId();
            if (StringUtils.isEmpty(flowableProcessId)) {
                throw WorkFlowErrorCodeEnum.FLOW_PROCESS_ID_IS_EMPTY.getException(new Object[0]);
            } else {
                Map<String, Integer> taskDefKeyExecuteCountMap = new HashMap();
                Iterator var6 = taskdefkeys.iterator();

                while(var6.hasNext()) {
                    String taskDefKey = (String)var6.next();
                    Object executeCount = this.runtimeService.getVariable(flowableProcessId, taskDefKey + "_executeCount");
                    if (ObjectUtils.isNotEmpty(executeCount)) {
                        taskDefKeyExecuteCountMap.put(taskDefKey, (Integer)executeCount);
                    }
                }

                FlowTaskRecordAndContentVO flowTaskRecordAndContentVO = new FlowTaskRecordAndContentVO();
                List<FlowTaskRecord> flowTaskRecordList = this.getFlowTaskRecordsForCurrentBatch(taskDefKeyExecuteCountMap);
                List<HistoricTaskInstance> histoyTaskInstanceList = ((HistoricTaskInstanceQuery)this.historyService.createHistoricTaskInstanceQuery().processInstanceId(flowableProcessId)).list();
                List<String> historyTaskId = (List)histoyTaskInstanceList.stream().map(TaskInfo::getId).collect(Collectors.toList());
                List<FlowTaskRecord> currentbatchRecordList = (List)flowTaskRecordList.stream().filter((flowTaskRecord) -> {
                    return historyTaskId.contains(flowTaskRecord.getTaskId());
                }).collect(Collectors.toList());
                List<FlowTaskRecord> flowTaskRecords = this.getFlowTaskRecordList(taskdefkeys);
                List<FlowTaskRecord> allRecordList = (List)flowTaskRecords.stream().filter((flowTaskRecord) -> {
                    return historyTaskId.contains(flowTaskRecord.getTaskId());
                }).collect(Collectors.toList());
                List<BigInteger> allRecordOids = (List)allRecordList.stream().map(FlowTaskRecord::getOid).collect(Collectors.toList());
                List<WorkFlowContentDataLinkDO> contentDataLinks = this.typlmWorkFlowContenDataLinkService.getLinkListByRecordOids(allRecordOids, true);
                if (CollectionUtils.isEmpty(contentDataLinks)) {
                    return flowTaskRecordAndContentVO;
                } else {
                    List<RecordContentDataVO> recordContentDataVOS = this.buildRecordContentDataVOS(contentDataLinks);
                    flowTaskRecordAndContentVO.setFlowTaskRecordList(currentbatchRecordList);
                    flowTaskRecordAndContentVO.setContentDataDOList(recordContentDataVOS);
                    return flowTaskRecordAndContentVO;
                }
            }
        }
    }

    private List<FlowTaskRecord> getFlowTaskRecordList(List<String> taskdefkeys) {
        Example example = new Example(FlowTaskRecord.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("taskDefId", taskdefkeys);
        return this.typlmFlowTaskRecordService.simpleQueryListByExample(example);
    }

    private List<RecordContentDataVO> buildRecordContentDataVOS(List<WorkFlowContentDataLinkDO> contentDataLinks) {
        List<String> taskdefkeyList = (List)contentDataLinks.stream().map(WorkFlowContentDataLinkDO::getTaskdefkey).distinct().collect(Collectors.toList());
        Map<String, List<BigInteger>> taskdefkeyMap = (Map)contentDataLinks.stream().collect(Collectors.groupingBy(WorkFlowContentDataLinkDO::getTaskdefkey, Collectors.mapping(WorkFlowContentDataLinkDO::getContentDataOid, Collectors.toList())));
        List<BigInteger> contentOids = (List)contentDataLinks.stream().map(WorkFlowContentDataLinkDO::getContentDataOid).collect(Collectors.toList());
        List<ContentDataDO> contentDataDOS = this.typlmContentDataService.queryContentDOsByOIDs(contentOids);
        List<RecordContentDataVO> contentDataVOList = new ArrayList();
        Iterator var7 = taskdefkeyList.iterator();

        while(true) {
            String taskdefkey;
            List contentOidList;
            do {
                if (!var7.hasNext()) {
                    return contentDataVOList;
                }

                taskdefkey = (String)var7.next();
                contentOidList = (List)taskdefkeyMap.get(taskdefkey);
            } while(CollectionUtils.isEmpty(contentOidList));

            Iterator var10 = contentDataDOS.iterator();

            while(var10.hasNext()) {
                ContentDataDO contentDataDO = (ContentDataDO)var10.next();
                if (contentOidList.contains(contentDataDO.getOid())) {
                    contentDataVOList.add(new RecordContentDataVO(contentDataDO.getOid(), contentDataDO.getFilename(), taskdefkey));
                }
            }
        }
    }

    public void saveFlowTask(FlowTaskInfo flowTaskInfo, List<ContentUploadVaultVO> contentUploadVaultVOList, List<BigInteger> needDeleteVaultitemOidList, List<BigInteger> needDeleteContentDataOidList) {
        TyplmLoggerUtil.debug(log, () -> {
            return "saveTask 方法入参flowTaskInfo ==> 【{}】";
        }, () -> {
            return new Object[]{JSONObject.toJSONString(flowTaskInfo)};
        });
        String taskId = flowTaskInfo.getTaskId();
        WorkFlowContainerView workFlowContainerView = flowTaskInfo.getWorkFlowContainerView();
        this.typlmWorkFlowContainerService.updateObjectLinkByFlowTaskInfo(flowTaskInfo);
        List<String> routerCheckList = flowTaskInfo.getRouterCheckList();
        this.taskService.setVariable(taskId, "routerCheck", CollectionUtils.isEmpty(routerCheckList) ? "" : StringUtils.join(routerCheckList.toArray(), ","));
        this.saveFlowVariable(flowTaskInfo);
        String remark = flowTaskInfo.getRemark();
        this.taskService.setVariable(taskId, "remark", StringUtils.isNotBlank(remark) ? remark : "");
        this.typlmFlowTaskUserService.updateUserTaskList(workFlowContainerView);
    }

    private void batchSaveContentData(FlowTaskInfo flowTaskInfo, WorkFlowContainerView workFlowContainerView, FlowTaskRecord flowTaskRecord) {
        List<ContentUploadVaultVO> contentUploadVaultVOList = flowTaskInfo.getContentUploadVaultVOS();
        List<BigInteger> needDeleteContentDataOidList = flowTaskInfo.getNeedDeleteContentDataOidList();
        List<WorkFlowContentDataLinkDO> workFlowContentDataLinkDOS = new ArrayList();
        if (!CollectionUtils.isEmpty(contentUploadVaultVOList)) {
            contentUploadVaultVOList.forEach((contentUploadVO) -> {
                ContentDataDO contentData = this.typlmContentDataService.queryContentDOByOID(new BigInteger(contentUploadVO.getContentId()));
                if (ObjectUtils.isNotEmpty(contentData)) {
                    WorkFlowContentDataLinkDO workFlowContentDataLinkDO = new WorkFlowContentDataLinkDO();
                    workFlowContentDataLinkDO.setOid(this.snowflakeIdComponent.getInstance().nextId());
                    workFlowContentDataLinkDO.setOtype("com.ty.entity.workFlow.WorkFlowContentDataLink");
                    workFlowContentDataLinkDO.setWorkFlowContainerOid(workFlowContainerView.getOid());
                    workFlowContentDataLinkDO.setContentDataOid(contentData.getOid());
                    workFlowContentDataLinkDO.setTaskdefkey(flowTaskInfo.getTaskDefKey());
                    workFlowContentDataLinkDO.setTaskid(flowTaskInfo.getTaskId());
                    workFlowContentDataLinkDO.setRecordOid(flowTaskRecord.getOid());
                    workFlowContentDataLinkDO.setRecordOtype(flowTaskRecord.getOtype());
                    TyplmEntityBaseUtil.fillCommonFieldForCreate(workFlowContentDataLinkDO);
                    workFlowContentDataLinkDOS.add(workFlowContentDataLinkDO);
                }

            });
        }

        this.typlmWorkFlowContenDataLinkService.batchInserWorkFlowContentDataLink(workFlowContentDataLinkDOS);
        this.typlmWorkFlowContenDataLinkService.batchRemoveContentDataLink(needDeleteContentDataOidList);
    }

    public void cancelSaveFlowTask(List<BigInteger> vaultitemOidList) {
        this.typlmVaultItemService.batchDeleteVaultItemDO(vaultitemOidList);
    }

    public List<FlowTaskRecord> queryFlowTaskRecord(BigInteger workFlowContainerOid) {
        WorkFlowContainer workFlowContainer = (WorkFlowContainer)this.typlmWorkFlowContainerService.selectOneByOid(workFlowContainerOid);
        List<FlowTaskRecord> flowTaskRecordList = this.typlmWorkFlowContainerViewService.getflowTaskRecordList(workFlowContainer.getOid(), workFlowContainer.getOtype());
        this.typlmWorkFlowContainerViewService.populateFlowTaskRecordContentData(flowTaskRecordList);
        return flowTaskRecordList;
    }

    private void populateFlowTaskRecordContentData(List<FlowTaskRecord> flowTaskRecordList, WorkFlowContainer workFlowContainer) {
        if (!org.apache.commons.collections4.CollectionUtils.isEmpty(flowTaskRecordList)) {
            Map<String, FlowTaskRecord> taskIdFLowTaskRecordMap = (Map)flowTaskRecordList.stream().collect(Collectors.toMap(FlowTaskRecord::getTaskId, Function.identity(), (a, b) -> {
                return b;
            }));
            List<FileDataVO> fileDataVOS = this.tyFileHandleService.getNormalFileListByEntity(Lists.newArrayList((Iterable)flowTaskRecordList.stream().map(FlowTaskRecord::getTaskId).collect(Collectors.toSet())), workFlowContainer.getOid());
            Map<String, List<FileDataVO>> taskIdFileDataVOMap = (Map)fileDataVOS.stream().collect(Collectors.groupingBy(FileDataVO::getTaskId));
            taskIdFLowTaskRecordMap.forEach((taskId, flowTaskRecord) -> {
                if (taskIdFileDataVOMap.containsKey(taskId)) {
                    flowTaskRecord.setFileDataVOList((List)taskIdFileDataVOMap.get(taskId));
                }

            });
        }
    }

    private static void reserveCompletedTask(Set<String> taskIds, Set<String> completedTaskIds, Map<String, FlowTaskRecord> taskIdFlowTaskRecordMap) {
        taskIds.removeAll(completedTaskIds);
        if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskIds)) {
            taskIds.forEach(taskIdFlowTaskRecordMap::remove);
        }

    }

    @NotNull
    private Set<String> obtainCompletedTask(Set<String> taskIds) {
        return (Set)taskIds.stream().filter((taskId) -> {
            HistoricTaskInstance historicTaskInstance = (HistoricTaskInstance)((HistoricTaskInstanceQuery)this.historyService.createHistoricTaskInstanceQuery().taskId(taskId)).singleResult();
            return !Objects.isNull(historicTaskInstance) && !Objects.isNull(historicTaskInstance.getEndTime());
        }).collect(Collectors.toSet());
    }

    private List<FlowTaskRecord> getFlowTaskRecordsForCurrentBatch(Map<String, Integer> taskDefKeyExecuteCountMap) {
        if (CollectionUtils.isEmpty(taskDefKeyExecuteCountMap)) {
            return Collections.emptyList();
        } else {
            Example example = new Example(FlowTaskRecord.class);
            taskDefKeyExecuteCountMap.forEach((key, value) -> {
                Example.Criteria criteria = example.createCriteria();
                criteria.andEqualTo("taskDefId", key);
                criteria.andEqualTo("executeCount", value);
                example.or(criteria);
            });
            return this.typlmFlowTaskRecordService.simpleQueryListByExample(example);
        }
    }

    private List<FlowableListener> getActivedUserTaskListeners(List<Task> list, Process process, String event) {
        if (org.apache.commons.collections4.CollectionUtils.isEmpty(list)) {
            return Collections.emptyList();
        } else {
            Set<String> activedTaskIds = (Set)list.stream().map(TaskInfo::getTaskDefinitionKey).collect(Collectors.toSet());
            if (org.apache.commons.collections4.CollectionUtils.isEmpty(activedTaskIds)) {
                return Collections.emptyList();
            } else {
                List<FlowableListener> listeners = new ArrayList();
                activedTaskIds.forEach((taskId) -> {
                    Map<String, FlowElement> flowElementMap = process.getFlowElementMap();
                    if (flowElementMap.containsKey(taskId)) {
                        listeners.addAll(((FlowElement)flowElementMap.get(taskId)).getExecutionListeners());
                    }

                });
                return (List)listeners.stream().filter((listener) -> {
                    return StringUtils.equals(event, listener.getEvent());
                }).collect(Collectors.toList());
            }
        }
    }

    private void createWorkFlowRecord(WithdrawProcessVO withdrawProcessVO, UserTask userTask, WorkFlowContainer workFlowContainer, String taskDefKey) {
        FlowTaskRecord flowTaskRecord = new FlowTaskRecord();
        flowTaskRecord.setTaskName(userTask.getName());
        flowTaskRecord.setTaskDefId(taskDefKey);
        flowTaskRecord.setOperateName("撤销重办");
        if (StringUtils.isNotEmpty(withdrawProcessVO.getRemark())) {
            flowTaskRecord.setRemark(withdrawProcessVO.getRemark());
        } else {
            flowTaskRecord.setApprovalOpinion(withdrawProcessVO.getApprovalOpinion().getBytes(StandardCharsets.UTF_8));
        }

        UserDO currentUser = TyplmWorkFlowUtil.getUser();
        flowTaskRecord.setOperatorOid(currentUser.getOid());
        flowTaskRecord.setOperatorName(currentUser.getFullname());
        flowTaskRecord.setOperatorOtype("com.ty.entity.user.PdmUser");
        flowTaskRecord.setCreatorOid(currentUser.getOid());
        flowTaskRecord.setCreatorName(currentUser.getFullname());
        flowTaskRecord.setCreatorOtype("com.ty.entity.user.PdmUser");
        flowTaskRecord.setUpdaterOid(currentUser.getOid());
        flowTaskRecord.setUpdaterOtype("com.ty.entity.user.PdmUser");
        this.typlmFlowTaskRecordService.createFlowTaskRecord(flowTaskRecord);
        FlowTaskRecordLink link = new FlowTaskRecordLink();
        link.setRecordOid(flowTaskRecord.getOid());
        link.setRecordOtype(flowTaskRecord.getOtype());
        link.setMasterObjectOid(workFlowContainer.getOid());
        link.setMasterObjectOtype(workFlowContainer.getOtype());
        link.setRecordOtype("com.ty.entity.workFlow.FlowTaskRecord");
        this.typlmFlowTaskRecordLinkService.createFlowTaskRecordLink(link);
    }
}
